2
tableview 셀에 사용자 정의보기를로드하려고합니다. 정확히, 개체 배열을 가지고 있고 사용자 지정보기를 사용하여 셀에 내용을 동적으로로드하려고합니다. 내가보기에 ... N1, N2의 값을 DISPALY하기 위해 노력하고있어사용자 정의 및 동적보기 - 내용이있는 UITableView 셀
{ ID = 1; date = "2014-01-06"; n1 = 12; n2 = 3; n3 = 34; n4 = 5; n5 = 44; n6 = 24; report = "<null>"; win = 123443; }
나는이 방법을 만들어 : 내 객체 구조는
@interface MenuCell : UITableViewCell
@property (nonatomic, strong) BallView *ballView;
@property (nonatomic, strong) IBOutlet UILabel *labelDescription;
@property (nonatomic, strong) IBOutlet UILabel *labelDetails;
@property (nonatomic, strong) IBOutlet UIView *ballsView;
+ (CGFloat)getCellHeight;
내 BallView.h
을@interface BallView : UIView
@property (nonatomic, strong) IBOutlet UIImageView *imgSelectedBall;
@property (nonatomic, strong) IBOutlet UILabel *labelNo;
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView *spinner;
+ (BallView*)showInView:(UIView*)parrentView xOrigin:(NSInteger)xOriginValue;
@end
내 BallView.m
+ (BallView*)showInView:(UIView*)parrentView xOrigin:(NSInteger)xOriginValue {
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"BallView" owner:self options:nil];
BallView *modal = [nibViews objectAtIndex:0];
modal.frame = CGRectMake(xOriginValue,ball_yOrigin, ball_width, ball_height);
[modal setBackgroundColor:[UIColor greenColor]];
[parrentView addSubview:modal];
return modal; }
,691,363 jQuery과 위임 메소드 내의 ViewController에서210
나는이 방법 (필자는 한 숫자 값으로 테스트를했다)의 정보를로드하려고 :
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"NewsCell";
MenuCell *cell = (MenuCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MenuCell_3" owner:self options:nil];
for (id currentObject in topLevelObjects){
if ([currentObject isKindOfClass:[UITableViewCell class]]){
cell = (MenuCell *) currentObject;
}
}
}
__block TickteObj *obj = [self.dataSourceArray objectAtIndex:indexPath.row];
if (obj){
__block CGFloat leftMark = ball_offSet;
for (int i = 1 ; i<5 ; i++){ //5 = my object has 6 numbers which must be displayed
__block BallView *ballView = [BallView showInView:cell.ballView xOrigin:leftMark];
cell.ballView.labelNo.text = obj.n1;
leftMark+=ball_offSet+ballView.frame.size.width;
}
}
return cell;
}
내가 내 셀의 값을로드하는 데 도움이 필요합니다. 감사 !
어떤 값을로드 하시겠습니까? 당신이 가지고있는 것만으로는 효과가 없습니다. 아니면 다른 n 값 (TickteObj의 인터페이스 표시)에 문제가 있습니다. – Wain
frst에 대해 obj.no1 (i = 0, obj.no2의 값을 i = 1)의 값을 표시하려고합니다. ifible을 사용하기 때문에 if 문을 사용하지 않습니다. 보기의 증가를위한 furture에서 ... –