开发者

basic iphone uiviewcontroller subclass

I'm a g++ programmer for OS X just trying to learn how to paint basically anything onto the screen.

I have read two similar tutorials, both of which mention creating a new file, identifying UIViewController as the subclass, opening the nib file, and changing the custom cl开发者_如何学JAVAass name to from UIViewController to the name of the new class I just created that descends from UIViewController (in this case "draw2D").

When I open the .xib and attempt to change the custom class property, the drop-down menu doesn't list the custom class I made. When I manually type it in and push enter (or focus out) XCode beeps at me (ah ... annoying).

Anyway, the manual drawing code I put in seems to compile just fine, but when I open the .xib file again my custom class name is gone.

Something fishy I noticed: No matter what I do, the draw2D files I added always end up in the "Supporting Files" folder instead of the same level as all my other source control files. I have tried manually moving them up a level (and even to the root level of my project). It doesn't make a difference.

I'm sure it's something stupid on my part, but I don't know what.


When you create a new file as a subclass of UIViewController, and include a nib file, it should already be set to the name of your custom controller. When you select your nib, make sure that in your yellow 3d box in the center of your screen is selected (files owner). The look at your custom class property drop down and it should show you the custom class you created.


Turns out I was editing the wrong .xib file. Totally my fault and something stupid! I wonder why so many .xib's get created for a UIView-based application where the programmer often draws all the graphics on their own.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜