你能PLZ看到下面的代碼來處理。我希望這將有助於你
- (void)viewDidLoad{
[super viewDidLoad];
// Create your image
UIImage *image = [UIImage imageNamed: @"person_menu.png"];
UIBarButtonItem *barButton = [[UIBarButtonItem alloc]
initWithImage:image
style:UIBarButtonItemStylePlain
target:nil
action:nil];
// set the text view to the image view
self.navigationItem.leftBarButtonItem = barButton;
menuItems = @[@"title", @"Payment", @"History",@"BookNow",@"Help", @"Promotions",@"Notifications", @"Settings", @"logOut"];
}
#pragma mark
#pragma mark - UITableViewDelegate Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
// Return the number of rows in the section.
return [menuItems count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
return 140;
}else{
return 75;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *CellIdentifier = [menuItems objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.highlighted = YES;
return cell;
}
什麼都你的UITableViewCell有標識,您可以收集這些並把它添加到一個NSArray的
對於你剛纔的情況下,你可以使用這樣的:
kzTexturedCellv2 *cell = [tableView dequeueReusableCellWithIdentifier:@"kzTexturedCellv2"];
不要忘記添加符號到字符串 – zakdances