• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom UIView drawing but can't figure out when/where it's loading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom UIView drawing but can't figure out when/where it's loading


  • Subject: Re: Custom UIView drawing but can't figure out when/where it's loading
  • From: Roland King <email@hidden>
  • Date: Wed, 15 Feb 2012 10:27:23 +0800




On 15 Feb, 2012, at 8:48, William Squires <email@hidden>
> AppDelegate loads the view controller and it's xib - confirmed, as the drawRect: method in TestView does its thing (ViewController.xib's view's class is set to TestView). But when I put an NSLog in TestView.m by adding a -(void)viewDidLoad(), it never fires, and neither does the -initWithFrame: method. So what's the correct place to put initialization code for a custom UIView subclass?

UIView doesn't have a viewDidLoad() method so your NSLog wouldn't fire.

UIView subclasses instantiated from NIBs have their initWithCoder: method called. That's documented in the NIB Object Life-Cycle documentation.  I usually write one initialization method and call it from initWithFrame: and initWithCoder:

Or use awakeFromNib.


> Or is my installation of Xcode screwed up?
>

Probably not. Why would you think that.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Custom UIView drawing but can't figure out when/where it's loading
      • From: "H. Miersch" <email@hidden>
References: 
 >Custom UIView drawing but can't figure out when/where it's loading (From: William Squires <email@hidden>)

  • Prev by Date: Re: Custom UIView drawing but can't figure out when/where it's loading
  • Next by Date: Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?
  • Previous by thread: Re: Custom UIView drawing but can't figure out when/where it's loading
  • Next by thread: Re: Custom UIView drawing but can't figure out when/where it's loading
  • Index(es):
    • Date
    • Thread