UINavigationBar 手动实现编辑和完成按钮
来源:互联网 发布:c语言打印字母图形 编辑:程序博客网 时间:2024/05/01 07:10
editButton = [[UIBarButtonItem alloc] initWithTitle:@”编辑” style:UIBarButtonItemStyleBordered target:self action:@selector(editAction)];
self.navigationItem.rightBarButtonItem = editButton;
}
-(void)ToReturn
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)editAction{
if (editButton.title == @”编辑”) {
[editButton setTitle:@"确定"];
[editButton setStyle:UIBarButtonItemStyleDone];
[self.roadTable setEditing:YES animated:YES];
}
else {
[editButton setTitle:@"编辑"];
[editButton setStyle:UIBarButtonItemStylePlain];
[self.roadTable setEditing:NO animated:YES];
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.titleArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @”Cell”;
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.text = [titleArray objectAtIndex:indexPath.row];
return cell;
}
//删除一行
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
//删除数组中的一条记录
[roadArray removeObjectAtIndex:indexPath.row -1];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert)
{
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
- UINavigationBar 手动实现编辑和完成按钮
- 自定义UINavigationBar和按钮
- UINavigationBar自定义导航栏背景和按钮
- UINavigationBar自定义导航栏背景和按钮
- UINavigationBar 设置透明 和去掉返回按钮
- 自定义UINavigationBar背景图片和Back按钮
- UInavigationBar自定义导航栏背景和按钮(二)
- iOS开发备忘录:自定义UINavigationBar背景图片和Back按钮
- UINavigationBar自定义返回按钮
- UINavigationBar自定义返回按钮
- 自定义UINavigationBar返回按钮
- Android实现监听EditText编辑完成事件
- 详解VC6.0中自己手动实现代码注释和取消注释的工具栏按钮功能
- UINavigationBar自定义背景以及按钮
- IOS UINavigationBar 自定义返回按钮
- UINavigationBar自定义背景以及按钮
- 修改返回按钮 标题 (UINavigationBar)
- 修改UINavigationBar的返回按钮
- 开源Jamendo在线音乐播放器源码(一)
- secureCRT连接虚拟机中的ubuntu方法
- CIF格式文件转BMP文件
- auto_ptr c++
- 青春划过指尖
- UINavigationBar 手动实现编辑和完成按钮
- 在application中 context的 在全局中使用是否会存在内存泄漏
- 经商之道28条+商场10忌
- SecureCRT脚本
- [java]线程总结
- 青涩的思绪 泛起粉色的涟漪
- vb连接数据库
- 【Effective c++】条款13:以对象管理资源
- ACM大牛!!!!!!