Skip to content

Commit

Permalink
moreKB update
Browse files Browse the repository at this point in the history
  • Loading branch information
tbl00c committed Mar 4, 2018
1 parent 18b6974 commit c78bf91
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ - (NSUInteger)p_transformIndex:(NSUInteger)index
#pragma mark - # Getter
- (NSInteger)pageItemCount
{
return (int)(SCREEN_WIDTH / (WIDTH_CELL * 1.3)) * 2;
return 8;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
@class TLUser;
@interface TLUserDetailViewController : ZZFlexibleLayoutViewController

@property (nonatomic, strong, readonly) TLUser *userModel;

- (instancetype)initWithUserId:(NSString *)userId;
- (instancetype)initWithUserModel:(TLUser *)userModel;
- (instancetype)init __attribute__((unavailable("请使用 initWithUserModel:")));
- (instancetype)init __attribute__((unavailable("请使用 initWithUserId: 或 initWithUserModel:")));

@end
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,29 @@ typedef NS_ENUM(NSInteger, TLUserDetailVCSectionType) {
TLUserDetailVCSectionTypeFunction,
};

@interface TLUserDetailViewController ()

/// 用户id
@property (nonatomic, strong, readonly) NSString *userId;
/// 用户数据模型
@property (nonatomic, strong) TLUser *userModel;

@end

@implementation TLUserDetailViewController

- (instancetype)initWithUserId:(NSString *)userId
{
if (self = [super init]) {
_userId = userId;
}
return self;
}

- (instancetype)initWithUserModel:(TLUser *)userModel
{
if (self = [super init]) {
_userId = userModel.userID;
_userModel = userModel;
}
return self;
Expand All @@ -53,6 +71,18 @@ - (void)viewDidLoad
{
[super viewDidLoad];

[self requestUserDataWithUserId:self.userId];
}

#pragma mark - # Request
- (void)requestUserDataWithUserId:(NSString *)userId
{
if (self.userModel) {
[self loadUIWithUserModel:self.userModel];
}

// 请求完整的数据模型
_userModel = [[TLFriendHelper sharedFriendHelper] getFriendInfoByUserID:userId];
[self loadUIWithUserModel:self.userModel];
}

Expand Down

0 comments on commit c78bf91

Please sign in to comment.