0
votes

I have a MainViewController class set up with a simple nib. On the nib i have only these few objects. I have set the popoverViewController's file owner to the MainViewController. enter image description here

I have set the popoverViewController class to my PVController class so that i can put buttons/code/labels etc. enter image description here

The Popover works fine, but somethings are is puzzling me which i need help to understand.

  1. That newly created PVController class has an init method that is never called when the popover is loaded. Yet the popover still works? If i put break points in the -(IBAction) buttons however, they are called when i click the buttons for them. But the init is never called. If I however, go to the file owner (MainViewController) and do --> PVController *pv = [[PVController alloc] init], only then it is called. So my first question is, will there be any problems if i do not alloc/init an IBOutlet in FileOwner, since it seems to work without it (altho the PVController's init method isnt called)? And why isnt it called?
  2. If i did decide to create that IBOutlet in FileOwner for the Popover View Controller's referencing outlet, do i make it as strong? or weak? My noobish instincts tells me weak because it is already owned by the NIB, but when i put weak, I get a yellow error next to the init of the IBOutlet saying message

enter image description here

1
Read this: developer.apple.com/library/ios/#documentation/cocoa/Conceptual/… (because the object is unarchived from the NIB file...) - Wain
You should also read the Resource Programming Guide, which explains, among other things, the correct ownership policies to use with nib objects. - Peter Hosey

1 Answers

1
votes

So my first question is, will there be any problems if i do not alloc/init an IBOutlet in FileOwner

NO, there will not be any problem. Infact IBOutlets are never alloc+init manually.