iPhone应用中的手机定制
我想在我的iPhone应用程序中创建一个表视图。。在该表格中,每个表格应包含1个图像、一些线条文本、一些符号等。。我现在不知道如何定制我们的表格单元格。如果您有..请提供一些帮助。我认为您可以使用默认的UITableViewCell来完成您所描述的操作,方法是使用适当的UITableViewCellStyle初始化单元格(在iPhone应用中的手机定制,iphone,Iphone,我想在我的iPhone应用程序中创建一个表视图。。在该表格中,每个表格应包含1个图像、一些线条文本、一些符号等。。我现在不知道如何定制我们的表格单元格。如果您有..请提供一些帮助。我认为您可以使用默认的UITableViewCell来完成您所描述的操作,方法是使用适当的UITableViewCellStyle初始化单元格(在-(UITableViewCell*)tableView:(UITableView*)tableView单元格for RowAtIndexPath:(NSIndexPath*
-(UITableViewCell*)tableView:(UITableView*)tableView单元格for RowAtIndexPath:(NSIndexPath*)indexPath
)
e、 g.:-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
return cell;
}
这给了你:
“单元格的一种样式,顶部有一个左对齐的标签,下面有一个左对齐的标签,以较小的灰色文本显示。iPod应用程序使用这种样式的单元格。”
此外,默认情况下,每种UITableViewCell都有一个图像属性
但以下是一些构建自定义单元的教程:
我认为您可以使用默认的UITableViewCell来完成您所描述的操作,方法是使用适当的UITableViewCellStyle初始化单元格(在
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
)
e、 g.:-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
return cell;
}
这给了你:
“单元格的一种样式,顶部有一个左对齐的标签,下面有一个左对齐的标签,以较小的灰色文本显示。iPod应用程序使用这种样式的单元格。”
此外,默认情况下,每种UITableViewCell都有一个图像属性
但以下是一些构建自定义单元的教程:
您可以在Interface Builder中创建单元格。从一个类似于视图的UITableViewCell开始,然后添加一个UIImage、一个或多个标签、任何用于保存符号的容器等 然后在cellForRowAtIndexPath中,加载笔尖并填写图片和标签等
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
MyTableCell *cell = (MyTableCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = myTableCell; // get the object from the outlet
myTableCell = nil; // make sure this can't be re-used accidentally
}
// Set up the cell...
cell.myViewController = self;
// set up image and labels here
return cell;
}
可以在Interface Builder中创建单元格。从一个类似于视图的UITableViewCell开始,然后添加一个UIImage、一个或多个标签、任何用于保存符号的容器等 然后在cellForRowAtIndexPath中,加载笔尖并填写图片和标签等
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
MyTableCell *cell = (MyTableCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = myTableCell; // get the object from the outlet
myTableCell = nil; // make sure this can't be re-used accidentally
}
// Set up the cell...
cell.myViewController = self;
// set up image and labels here
return cell;
}