2011-03-24 4 views
1

TTMessageController을 사용하여받는 사람 선택 도구와 SMS 메시지를 작성하기위한 텍스트 영역을 가져옵니다. 그러나 내가 필요로하지 않는이 "제목"필드는 여전히 있습니다.TTMessageController 필드를 사용자 정의하는 방법은 무엇입니까?

어떻게 제거하나요?

self.second [[SecondViewController alloc] init]; 
[self.second release]; 

UINavigationViewController *navigationController = 
       [[UINavigationController alloc] 
       initWithRootViewController:self.second]; 
[self presentModalViewController:navigationController animated:YES]; 

SecondViewController이 TTMessageController의 서브 클래스 :

이 내가 TTMessageController을 만드는 방법이다. 그렇다면 필드, 특히 제목 필드를 제거/추가하려면 어떻게 사용자 정의합니까?

답변

1

TTMessageController의 하위 클래스를 만들고 initWithNibName을 재정의합니다. overwrited initWithNibName 메소드에서 원하는 필드 만 유지하도록 _fields 배열을 설정하십시오. 아래의 예는받는 사람 : 필드 만 유지합니다.

/////////////////////////////////////////////////////////////////////////////////////////////////// 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { 

     self.dataSource = [[AddressBookDataSource new] autorelease]; 


     _fields = [[NSArray alloc] initWithObjects: 
        [[[TTMessageRecipientField alloc] initWithTitle: TTLocalizedString(@"To:", @"") 
                  required: YES] autorelease], nil]; 



     self.showsRecipientPicker = YES; 

     self.title = TTLocalizedString(@"New Message", @""); 

     self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] 
                initWithTitle: TTLocalizedString(@"Cancel", @"") 
                style: UIBarButtonItemStyleBordered 
                target: self 
                action: @selector(cancel)] autorelease]; 
    } 

    return self; 
} 
+0

SMSMessageRecipientField 란 무엇입니까? 나는 그것을 만들어야합니까? –

+1

죄송합니다. 그건 내 프로젝트의 TTMessageRecipientField의 하위 클래스입니다. TTMessageRecipientField로 대체 할 수 있습니다. –

관련 문제