UITableView 使用2
-
//返回有多少个Sections
-
-
(NSInteger)numberOfSectionsInTableV iew:(UITableView *)tableView -
{
-
return 1; -
}
-
-
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -
{
-
return 10; -
}
-
-
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -
{
-
static "ShowUserInfoCell";NSString * showUserInfoCellIdentifi er = @ -
UITableViewCell * cell = [tableView_ dequeueReusableCellWithI dentifier:showUserInfoCellIdentifi er]; -
if (cell == nil) -
{ -
// Create a cell to display an ingredient. -
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubt itle -
reuseIdentifier:showUserInfoCellIdentifi er] -
autorelease]; -
} -
-
// Configure the cell. -
cell.textLabel.text=@"签名"; -
cell.detailTextLabel.text = [NSString stringWithCString:userInfo.user_signature.c_str() encoding:NSUTF8StringEncoding]; -
} -
-
-
(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection :(NSInteger)section -
{
-
if (section ==0) -
return 80.0f; -
else -
return 30.0f; -
}
-
-
(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section -
{
-
if (tableView == tableView_) -
{ -
if (section == 0) -
{ -
return "title@ ;1" -
} -
else if(section == 1) -
{ -
return "title@ ;2" -
} -
else -
{ -
return nil; -
} -
} -
else -
{ -
return nil; -
} -
}