Tôi đang cố gắng kích hoạt chế độ chỉnh sửa cho UITableView. Khi tôi nhấp vào nút "Chỉnh sửa", nó thay đổi thành "Xong" nhưng các dấu trừ màu đỏ trừ tròn không hiển thị trong bảng. Tôi đang đăng bài dưới đây một số phương pháp của lớp. Ứng dụng đại biểu đã tạo Tab Tab và các chế độ xem bên trong các tab có trình điều khiển điều hướng. tất cả được thực hiện trong mã, ít được thực hiện với các tập tin nib. Chuyện gì vậy?Chế độ chỉnh sửa UITableView không hoạt động
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [ikub.subscriptions count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
int i = [indexPath row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
}
Subscriptions *s = [ikub.subscriptions objectAtIndex:i];
cell.textLabel.text = [s title];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ artikuj te rinj, %@ artikujt te lexuar", [s new], [s read]];
if (deleteActive) {
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
} else {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Subscriptions *s = [ikub.subscriptions objectAtIndex:[indexPath row]];
NSString *address = [[NSString alloc] init];
NSString *type = [NSString stringWithString:[s type]];
if ([type isEqualToString:@"Category"]) {
address = [NSString stringWithFormat:@"http://www.ikub.al/Rss.aspx?node=9e26cdb8-dba6-4504-8bb6-29f0753be179~%@", [s code]];
} else if ([type isEqualToString:@"Tag"]) {
address = [NSString stringWithFormat:@"http://www.ikub.al/Rss.aspx?tag=%@", [s code]];
}
address = [address stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
SubscriptionStories *ss = [[SubscriptionStories alloc] init];
ss.address = address;
ss.title = [s title];
[self.navigationController pushViewController:ss animated:YES];
[ss release];
}
- (void)viewWillAppear:(BOOL)animated {
[subscriptionsTable reloadData];
}
- (void)viewDidLoad {
refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:nil];
self.navigationItem.leftBarButtonItem = refreshButton;
[refreshButton release];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
[super viewDidLoad];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
hey olsi xin vui lòng chỉnh sửa câu hỏi của bạn, bằng cách định dạng đúng. Rất khó để hiểu mã. Không có khoảng cách giữa kết thúc và bắt đầu của các phương thức. – iPhoneDev