如何更改UITableView中每个单元格末尾出现的分隔线?我想要一个图像是一个薄分隔符类型的线图像.
我有一个UIViewController实现TableViews委托和数据源协议.现在我想向细胞添加"轻扫删除"手势.
我应该怎么做呢.
我给出了commitEditingStyle方法的空白实现,并将Editing属性设置为YES.
仍然没有滑动功能.
现在我需要单独添加UISwipeGesture到每个单元格吗?
或者我错过了什么?
我正在做一个项目.我有很多UITableViews设置为清晰的颜色.他们的观点背景颜色设置为我的自定义颜色,iPhone上的一切都很好.
这个问题出现在iPad上!我几乎尝试了所有东西,但我UITableView的颜色是白色.
我检查了其他主题,例如:UITableView backgroundColor在iPad上总是灰色,但没有任何效果.另外,我的问题不是灰色,它像雪一样白!
可能是什么原因?
我是Swift的初级开发人员,我正在创建一个包含UITableView的基本应用程序.我想使用以下方法刷新表格的某一行:
self.tableView.reloadRowsAtIndexPaths(paths, withRowAnimation: UITableViewRowAnimation.none)
Run Code Online (Sandbox Code Playgroud)
我希望刷新的行来自一个名为rowNumber的Int
问题是,我不知道如何做到这一点,我搜索的所有线程都是Obj-C
有任何想法吗?
我正在尝试建立一个机制来深入查看文件/文件夹列表.想法是每次用户选择文件夹时显示相同的文件列表视图控制器,并且如果他/她选择文件则显示文件详细视图控制器.
到目前为止,我已经从文件列表视图控制器创建了一个segue到文件详细信息视图控制器,并从文件列表表视图单元格到文件列表表视图控制器创建了一个segue:
这个问题是,一旦用户点击单元格,就会执行segue.我想从表视图单元格中删除segue,并从文件列表视图控制器中创建一个到自身.这样,当用户点击单元格时,我可以以编程方式触发右侧segue.
所以,我的问题是:是否可以在Interface Builder中从视图控制器创建一个segue?
尽管已经为所有元素设置了约束,包括单元格计算其高度所需的垂直元素,但自动布局似乎被忽略:所有单元格都被挤压.
在包含tableView的VC中,这是viewDidLoad中的代码:
tableView.estimatedRowHeight = 120.0
tableView.rowHeight = UITableViewAutomaticDimension
Run Code Online (Sandbox Code Playgroud)
注释掉第二行会使单元格的高度为120.0,但也会忽略Autolayout.
谢谢
为了简化界面,我留下了一个标签,作为约束:
通过这个简化的界面,仍然没有考虑自动布局,这暗示我的问题并非来自严重设置的约束.
在"大小"检查器中,行高设置为120,并选中"自定义".单元格具有正确的自定义类,单元格重用标识符是正确的.
这是一个简单的错误,请参阅下面的答案.
我有一个UITableView,显示当月的费用(见截图):
我的问题是空部分的标题.有没有办法隐藏它们?数据从coredata加载.
这是生成标题标题的代码:
TitleForHeader
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0) {
return nil;
} else {
NSDate *today = [NSDate date ];
int todayInt = [dataHandler getDayNumber:today].intValue;
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:(-(todayInt-section-1)*60*60*24)];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]]];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSString *formattedDateString = [dateFormatter stringFromDate:date];
return formattedDateString;}
}
Run Code Online (Sandbox Code Playgroud)
ViewForHeader
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0) {
return nil;
} else {
UIView *headerView = …Run Code Online (Sandbox Code Playgroud) 有谁知道之间的区别NSIndexpath.row和NSIndexpath.item?
具体来说,我使用哪一个:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
Run Code Online (Sandbox Code Playgroud) 如何使用Objective C在iOS7 UITableView中制作自定义编辑视图,如Evernote或Apple Reminders应用程序,同时向左滑动.我试图设置自定义editingAccessoryView,但这不起作用.
Evernote编辑视图:
提醒编辑视图:

我目前的代码是
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSLog(@"delete");
}
}
Run Code Online (Sandbox Code Playgroud)
我试图用以下方法解决问题:(UITableViewController.h)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//make cell
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[view setBackgroundColor:[UIColor greenColor]];
//add Buttons to view
cell.editingAccessoryView = view;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
与之相同:(UITableViewCell)
- (void)willTransitionToState:(UITableViewCellStateMask)state;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
- (UIView*)editingAccessoryView;
Run Code Online (Sandbox Code Playgroud) 我创建了一个UITableView与UITableViewCell.在视图单元之间有生长线.我想删除这些行并且不想显示它们,但我不知道如何.
我使用Xcode 6.1和Swift.
这是显示我的屏幕的屏幕截图:
谢谢!
uitableview ×10
ios ×9
swift ×4
objective-c ×3
nsindexpath ×2
ipad ×1
iphone ×1
segue ×1
storyboard ×1
swipe ×1
tableview ×1
xcode ×1