xcode / storyboard : 막대 버튼을 상단의 도구 모음으로 끌 수 없습니다.
테이블의 상세 뷰인 뷰 컨트롤러가 있습니다. 표의 행을 클릭하면 상세보기로 이동합니다. 상세보기는 탐색 컨트롤러에 내장되어있어 탐색 표시 줄의 왼쪽 상단에 테이블로 돌아가는 버튼이 있습니다. 여태까지는 그런대로 잘됐다.
이제 상세보기를 편집 할 수 있도록 탐색 모음의 오른쪽에 편집 단추를 추가하려고합니다. 내 계획은 항목의 세부 사항을 편집 할 수있는 또 다른 뷰 컨트롤러를 모달로 추가하는 것입니다. 표준 물건.
그러나 개체 목록에서 탐색 모음으로 막대 단추 항목을 끌려고하면 시간이 걸리지 않습니다. 대신 마우스 버튼에서 손을 떼면 하단의 탭 막대 컨트롤러에 막대 버튼이 남습니다. (내 탐색 체계에는 다른 탭이 포함되어 있으며 각 탭에 대해 테이블, 상세보기 등이 있습니다.)
누구든지이 문제를 경험하고 내가 뭘 잘못하고 있는지 또는 탐색 화면의 오른쪽에 막대 버튼 항목을 추가하는 일종의 해결 방법을 제안 할 수 있습니다. 코드에 추가해야합니까?
제안 해 주셔서 감사합니다.
Xcode6을 사용하여 동일한 문제가 발생했으며 NavigationController에 포함 된 첫 번째 ViewController에 대해 UINavigationItem이 자동으로 추가되지만 후속 ViewController의 경우 다음과 같이 수동으로 추가해야합니다.
- 개체 라이브러리에서 탐색 항목을 찾은 다음 스토리 보드의 두 번째 ViewController로 드래그합니다.
- 개체 라이브러리에서 Bar Button Item을 찾은 다음 이전 단계에서 만든 탐색 항목으로 끕니다.
이제 바 버튼이 씬의 상단에 붙어 있습니다.
업데이트 솔루션은 여전히 XCode 7에서 작동하지만 좀 더 설명적인 사진을 추가하고 싶었습니다. 위에서 언급 한 표준 또는 기술 이름에 익숙하지 않은 사람이있는 경우를 대비하여. 오른쪽의 빨간색 화살표는 위에서 언급 한 1 단계, 2 단계를 나타냅니다. 또한 왼쪽 빨간색 직사각형의 뷰 계층 구조에 유의하십시오.
불쾌한 속임수 :
- Segue를 푸시로 변경하십시오.
- 필요한 콘텐츠 설정
- 다시 표시하도록 설정
그러면 콘텐츠를 편집 할 수 있고 segue에 대해 더 이상 사용되지 않는 스타일이 있습니다.
Your storyboard's view controller is likely missing a Navigation Item
. You can drag one from the Object library, and drop it on your view controller.
You'll then be able to drag and drop bar button items onto the left or right side of the navigation bar.
i Solved it. drag in 'Navigation Item' to your detail view. than you can drag in the Bar Button Item.
The way that I fixed this issue was, instead of dragging a UINavigationController into the Storyboard and trying to add UIBarButtonItems to that, I dragged in a UITableViewController and then went to
Editor->Embed In->Navigation Controller
Which gave the same result as before except I could add UIBarButtonItems to both sides of the navigation bar with no issues.
Its actually xcode issue. One trick which worked for me is to add the bar button in the VIEW FILE STRUCTURE ON THE LEFT.Instaed adding on the view directly. Hope it helps you.:)
I think it is a bug. I had the same problem.I fixed this problem by disable the size classes, then enable it.
You can disable and enable the size classes in Interface builder doc.
I also had this problem, close and reopen the project worked for me.
I believe it's an XCode quirk. I had the same issue. I had to reset Xcode and shift the placement of things on the storyboard to finally get it to go. It's working now.
I think this is a bug of Xcode. In Xcode 8, change the segue
in storyboard before the tab bar view controller to all its options (show detail
, present
...). Then back to show
. Try to drag bar button items and modify tile. It works for me!
Did you try "cleaning" your project? I know that helps me sometimes (just go to "Product" > "Clean"). Or, alternatively, delete the navigation bar and try it again.
If you think it's a programming error, feel free to pass on your code. I'd be happy to help in any way I can. :)
You must reset xCode IDE . Close xCode and write the below codes at terminal...It will work.
rm -rf $HOME/Library/Application Support/Developer/Shared/Xcode
rm -rf $HOME/Library/Preferences/com.apple.dt.Xcode.*
rm -rf $HOME/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
rm -rf $HOME/Library/Developer/Xcode
Same issue. I had a Table View Controller inside a Navigation Controller and many ViewControllers following further down the chain. A 'Navigation Item' was being created automatically for the FIRST root view controller and I could add a 'Bar Button Item' to this without a problem. Via the Storyboard, drag and drop. But thats all. On the following Table View Controller and further view controllers, even though they were within the initial Navigation Controller (auto generated back button appeared), storyboard would never let me add a Bar Button Item.
Wael Showair's solution did not work for me. Bar Button Items wouldn't appear.
I solved it programmatically in the end (Swift 2.0):
var testButton = UIBarButtonItem(title: "Test Button", style .Plain, target: self, action: "testButtonMethod")
self.tabBarController?.navigationItem.rightBarButtonItem = testButton
No extra Navigation item or Bar Button Item needed.
I was too facing the same problem.I was able to fix this issue by selecting the root view controller option and then in simulated matrix changed the Top bar option to Opaque Navigation Bar and was able to add the item on top of navigation bar.Hope this answer will help someone.
I had the same issue in xcode 8. I had to simply close xcode and reopen the project and then I was able to add the bar button to the Root Controller without any issues.
For XCode 8
There are many answers here. I tried some of them but I couldn't make it. So I found my solution, just select your ViewController
, go Attributes Inspector section and change the Top Bar to Opaque Navigation Bar and Boom. You will see navigation bar on your storyboard. You can change the title or add some item. If you don't want to keep Opaque you can change style to Inferred.
In Xcode 10, I just changed the type of segue going to this new view controller to 'Push (deprecated)', added the navigation item as it was allowed after I made this switch. If you switch back to your originally desired segue type, the navigation item will remain.
"Bar Button Item"을 "Navigation Controller"로 드래그하는 대신 "Detail View Controller"로 드래그하십시오. 상세보기를 "탐색보기"에 임베드하면 "탐색 항목"이 "상세보기 컨트롤러"에 추가됩니다. "Bar Button Item"을 탐색 항목의 오른쪽으로 드래그하면 항목이 "Right Bar Button Items"아래에 포함됩니다.
Mark Lyons가 말했듯이 동일한 솔루션을 사용했습니다.
- 먼저 푸시 segue 사용
- 바 항목 추가
- segue를 보여주기 위해 돌아가다
- 끝난
참고 URL : https://stackoverflow.com/questions/29435620/xcode-storyboard-cant-drag-bar-button-to-toolbar-at-top
'program tip' 카테고리의 다른 글
텍스트 너비 계산 (0) | 2020.08.21 |
---|---|
AWS S3 : 사용중인 디스크 공간을 확인하려면 어떻게해야합니까? (0) | 2020.08.21 |
Javascript : 반올림 된 숫자를 N 소수로 포맷 (0) | 2020.08.21 |
C / C ++에서 1 비트가 설정되었는지 확인합니다. 즉, int 변수 (0) | 2020.08.21 |
JQuery를 사용하여 그룹의 라디오 버튼이 확인되지 않았는지 확인 (0) | 2020.08.21 |