2012-07-02 2 views
0

안녕하세요. 내보기에 tableView이 있습니다. 하지만 탐색 모음의 편집 tableView 작동하도록합니다. 이걸 어떻게 할 수 있는지 말해 주시겠습니까?탐색 표의 편집 버튼을 사용하여 하위 표보기

기본보기에 탐색 모음이 설정되어 있고 tableView도 설정되어 있습니다. 나는

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 

뿐만 아니라 설정이

- (UINavigationBar *)createNavigationBar 
{ 
UINavigationItem *title = [[UINavigationItem alloc] initWithTitle:@"Task Manager"]; 
UINavigationBar *new = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; 

UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:nil]; 
title.leftBarButtonItem = addButton; 
[new pushNavigationItem:title animated:YES]; 
UIColor *color = UIColorFromRGB(0xff8c00); // Dark orange 
new.tintColor = color; 
return new; 
} 

:

나는 네비게이션을 만들 줄 방법을했다.

기본적으로 기본 탐색 모음에서 편집 버튼을 누르면 sub-tableView에 빨간색 원이 표시되어야합니다.

내가 명확하지 않으면 죄송합니다. 설명이 필요한지 저에게 물어보십시오.

감사합니다. :)

답변

0

:

-(IBAction) editWasPressed:(id)sender 
{ 
    editMode = ! editMode; 

    if(editMode) 
    { 
     [table setEditing:YES animated:YES]; 
    } 
    else 
    { 
     [table setEditing:NO animated:YES]; 
    } 
} 

new이라는 변수의 이름을 다른 것으로 변경해야합니다!

0
그냥 ... 당신이 당신의 버튼 동작이 코드를 넣어이

[yourTableView setEditing:YES animated:YES]; 

처럼 그것을 할 수 있습니다 .. 당신의있는 tableView가 편집 모드로 만들 필요가 그래서 당신은 변경해야

당신의 코드처럼이

UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editPressed)]; 
당신은 다음과 같이이 변수에 따라 편집 모드에서 테이블을 넣어 것입니다 현재의 편집 상태와 편집 버튼에 기능 ( addTarget)를 저장하는 BOOL 변수를 가져야한다
0

메이크업 당신의 viewWillApear에서이 라인 : ... 당신의 editWasPressed에서 다음

[super setEditing:NO animated:yes]; 

: 방법 ...

[my_table setEditing:!my_table.editing animated:YES]; 

희망이 당신을 도울 것입니다 .... .

관련 문제