탐색 모음에 단추를 추가하려고합니다. 아무런 조치없이 단추를 추가하고 싶습니다.xcode에서 프로그래밍 방식으로 탐색 바에 버튼을 추가 할 수 있습니다
2
A
답변
3
UIBarButtonItem *yourButton = [[UIBarButtonItem alloc]
initWithTitle:@"Your Button"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(methodName:)];
self.navigationItem.rightBarButtonItem = yourButton;
[yourButton release];
그리고 그 방법은
-(IBAction)methodName {
// your code here
}
0
대신있는 UIButton의 바 NAV 대비 UIBarButtonItem을 추가해야합니다. T는 당신이 호출 할 수있는 수행
이UIBarButtonItem *button = [[UIBarButtonItem alloc]
initWithTitle:@"Title"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
self.navigationItem.rightBarButtonItem = button;
0
UIBarButtonItem *customBtn=[[UIBarButtonItem alloc] initWithTitle:@"Custom" style:UIBarButtonItemStylePlain target:self action:@selector(customBtnPressed)];
[self.navigationItem setRightBarButtonItem:customBtn];
/////있는 UIButton이 당신이 정말로 원하는 경우 이벤트
-(IBAction)customBtnPressed:(id)sender
{
//Your code here
}
0
불리는이 시도.
UIButton *btnSample = [[UIButton alloc] initWithFrame:btnFrame];
btnSample.backgroundColor = [UIColor blueColor];
UIBarButtonItem *barBtn_cart = [[UIBarButtonItem alloc] initWithCustomView:btnSample];
self.navigationItem.rightBarButtonItem = btnSample;
관련 문제
- 1. Xcode에서 UITabBar 버튼을 프로그래밍 방식으로 누르기
- 2. iPhone-SDK : 탐색 바에 이미지 추가 :
- 3. 카메라 활동에서 캡처 버튼을 프로그래밍 방식으로 호출 할 수 있습니다.
- 4. 프로그래밍 방식으로 설정된 framelayout에 버튼을 추가 할 수 있습니까?
- 5. 프로그래밍 방식으로 버튼을 정렬 할 수 없습니다.
- 6. 프로그래밍 방식으로 PowerPoint를 탐색
- 7. 프로그래밍 방식으로 Xcode에서 이미지를 선언 할 위치
- 8. Pinax 탐색 바에 버튼을 추가하는 방법, site_base.html?
- 9. 프로그래밍 방식으로 이미지를 추가 할 수 있습니까?
- 10. 프로그래밍 방식으로 사이트 탐색
- 11. 프로그래밍 방식으로 RelativeLayout을 추가 할 수 없습니다.
- 12. 행은 프로그래밍 방식으로 추가 할 수 없습니다
- 13. iPhone 탐색 바에 "정보"버튼을 넣을 수 있습니까?
- 14. modalView를 사용하여 탐색 바에 barButton 추가 iphone
- 15. 프로그래밍 방식으로 단추 추가
- 16. 버튼을 프로그래밍 방식으로 생성
- 17. 내 탐색 바에 문제가 있습니다. (이미지 참조)
- 18. 프로그래밍 방식으로 UINavigationBar에 프롬프트 추가
- 19. 프로그래밍 방식으로 단추로보기 추가
- 20. 은 필요에 따라 탐색 바에 항목을 표시 할 수 없습니다.
- 21. 프로그래밍 방식으로 추가 된 UICcrollView에서 UIButtons를 클릭 할 수 없습니다.
- 22. 사이드 바에 Like Like 버튼을 배경으로 추가
- 23. iPad : 뒤로 버튼을 교체하지 않고 탐색 바에 라벨을 추가하려면 어떻게해야하나요?
- 24. 프로그래밍 방식으로 야후 메신저 탐색
- 25. 특정 애플리케이션을 열어주는 탐색 바에 사용자 정의 버튼을 추가하십시오. android
- 26. Xcode에서 프로그래밍 방식으로 패스 (.pkpass 파일)를 만들 수 있습니까?
- 27. 네비게이션 바에 편집 버튼을 추가하려고합니다.
- 28. 프로그래밍 방식으로 버튼을 클릭하십시오 - JS
- 29. PhoneApplicationPage를 프로그래밍 방식으로 만들고 탐색 할 수 있습니까?
- 30. 프로그래밍 방식으로 탐색 컨트롤러를 구축/탐색하십시오.
여기에서 바 버튼 항목의 Apple 문서를 읽는 것이 좋습니다. https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html –