2013年5月2日 星期四

UIBarButton init 使用 SystemItem 以及 WithTitle

UIBarButton

兩種 alloc & init 的方法


第一種 , 使用 SystemItem
     UIBarButtonItem *saveButton = [[UIBarButtonItem alloc]
                                    initWithBarButtonSystemItem:UIBarButtonSystemItemDone
                                   target:self
                                   action:@selector(deleteAction:)];
    saveButton.style = UIBarButtonItemStyleBordered;




第二種 , 使用自定義文字
    UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Recent" style:UIBarButtonItemStyleBordered target:self action:@selector(deleteAction)];
    saveButton.tag = 1;

沒有留言:

張貼留言