![](/img/trans.png)
[英]How to implement search through all iOS application (not just one table)? Is there any framework for that kind of search?
[英]How to implement this kind of style table
单元格内有表格,每个小单元格均可单击以触发另一页。
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString* cellIdentifier = @"cellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
UIButton* tempBtn1;
UIButton* tempBtn2;
if(cell == nil)
{
cell = (UITableViewCell*) [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
tempBtn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
tempBtn1.tag = 123;
tempBtn1.frame = CGRectMake(0, 0, 160, 44);
[tempBtn1 setTitle:@"firstBtn" forState:UIControlStateNormal];
[cell.contentView addSubview:tempBtn1];
tempBtn2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
tempBtn2.tag = 234;
tempBtn2.frame = CGRectMake(160, 0, 160, 44);
[tempBtn2 setTitle:@"secondBtn" forState:UIControlStateNormal];
[cell.contentView addSubview:tempBtn2];
}
else {
tempBtn1 = (UIButton*)[cell.contentView viewWithTag:123];
[cell.contentView addSubview:tempBtn1];
tempBtn2 = (UIButton*)[cell.contentView viewWithTag:234];
[cell.contentView addSubview:tempBtn2];
}
return cell;
}
创建一个UIView子类。 这将代表一项(单元格内容的1/2)。 在每个单元格中添加两个。 在获取触摸事件时,在此UIView子类中检测触摸并推送新的ViewController。
这看起来像Twitter应用程序。
我认为,这些方法可以帮助您:
labelView
[UIButton alloc] buttonWithType: UIButtonTypeCustom]
lableView
添加为该按钮的子视图。 要创建分隔符: #import <QuartzCore/QuartzCore.h>
,然后
labelView.layer.borderSize = 1;
labelView.layer.borderColor = [UIColor grayColor].CGColor;
手动将按钮移动到适当的位置。 您可能要使用: cell.contentView.clipsToBounds = YES
希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.