1. gairp's Avatar
    i was trying to create simple animation,but something is wrong in my code
    main UIView :
    Code:
    @interface TouchResponder : UIView {
        IBOutlet UIView *stalker;    
    }
    @end
    i want to display stalker with code. and i am initializing it in TouchResponder's init ;
    Code:
    @implementation TouchResponder 
    - (id)init
    {
        self = [super init];
        if (self) {
            CGRect  viewRect = CGRectMake(10, 10, 100, 100);
            stalker = [[UIView alloc] initWithFrame:viewRect];
            [stalker setCenter:CGPointMake(0,0)];
            [stalker setBackgroundColor:[UIColor blueColor]];
        }
        return self;
    }
    I only want to display that blue rectangle in my main UIView
    05-18-2011 12:03 PM
  2. osmosisapps's Avatar
    Is the problem that the view doesn't appear?

    If so, you might find that you need to implement initWithFrameCGRect)frame rather than init, as that is the standard way. If the view is being initialised from a nib file, then you will also need to implement initWithCoder:

    Hope this helps.
    gairp likes this.
    05-21-2011 08:06 AM
  3. gairp's Avatar
    thanks, i understand : ))
    but i wrote it without any IBOutlets , its more complex for me
    05-23-2011 04:23 AM
LINK TO POST COPIED TO CLIPBOARD