其实我试图在UITableView的不同行中实现不同的图像。 通过创建一个新的UITableViewCell我试了很多实现这个,但我失败了。我需要在每一行设置两个图像和一个标签。 怎么办? 我必须使用导航控制器在下一页中获取图像... 请指定我的代码和解释,否则我无法理解。 谢谢您的信息的答案...如何自定义UITableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 5;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
sampletable1 *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"sampletable1" owner:nil options:nil];
for (UIView *view in views) {
if([view isKindOfClass:[UITableViewCell class]])
{
cell = (sampletable1*)view;
}
}
}
您将图像和文本放在标签中的哪个位置?您想要设置的'sampletable1'对象中的属性是什么? –
我已经创建了一个名为images的组。样本表1中没有添加任何属性。 – goku
我不知道你是什么意思的“组”。如果您的自定义单元格没有任何属性,它具有哪些**? –