Objective-C 관련 자료는 정말정말 네이버보다는 구글링이 짱인 듯 싶습니다. 대부분 찾는 내용들이 http://stackoverflow.com/ 에 있더군요~ 필요한 것들은 개인적으로 Evernote 에 저장해놓고 검색해서 쓰는데, 포스팅도 같이 해봅니다.
(대부분 Evernote 에 Copy 본을 올리는 부분은 StackOver 의 질문과 대답 부분을 발췌해서 포스팅할 생각입니다.)
I am making a simple app to display drink details, and now I am trying to add a view that allows the user to input their own drink. I already created a view to display the details, and now I am just passing the view into another controller to make the add drink view. Problem is, when I try to add a "cancel" and "save" button, it doesn't appear, although the code complies without any errors. I have attached code as reference.
This is the code that makes the new view, when the add button is pressed. (I made an add button that works, and it pulls up the nav bar)
This is the code from the addviewcontroller implementation file:
I have imported the header from the addview into the root controller, so I don't think that is the problem, do any of you guys see anything that's wrong?`
My advice to you is to create a template for the view before you run through any code in the XIB file of your app. Rather than trying to set each button after allocating a brand new view, setting a new one in the XIB before-hand allows you to link each element with the app and make sure it looks just right before you debug.
Simply go into your "[Your-App-Name]viewController.xib" and drag a view from the objects library to the pane on the left. From here add each of your elements and position them where you want on the view. Now in the "[Your-App-Name]viewController.h" file, add IBOutlets for each element that you need to change, and add IBActions for each of the buttons. Also create an IBOutlet for the new view.
Back in the XIB file, use files owner to link each outlet to each element and each method to each button. Make sure you link the IBOutlet
Now in your "[Your-App-Name]viewController.m" file, you can define each button method and all you need to do to access the new view and dismiss it are the following:
This should be much easier than trying to position everything in code.
Hope this helps!
|[iOS프로그래밍] AlertView 버튼 클릭 시 기능 구현 (1)||2012.05.24|
|[iOS프로그래밍] Navigation Bar 에 Button 붙이기 (0)||2012.05.24|
|[iOS프로그래밍] Objective-C Code Rule (0)||2012.05.16|
|[iOS프로그래밍] 뷰 안에 뷰는 관리하지 않는다! (1)||2012.05.15|
|[iOS프로그래밍] Loaded “xxx” nib but the view outlet was not set 해결방법 (2)||2012.05.11|