开发者

Can i call a method inside a class(subclass of UIView) from another class?

Its kinda开发者_运维技巧 weird but i am not able to call any method defined inside the class (having the drawRect method).

This is what i do inside a UIviewcontroller class with nib for UI:

-(void)viewDidLoad {
    [self.lineVar Start];
}

lineVar is an object of the class (which is a subclass of UIview) which has the function Start.

-(void)Start {
    NSLog(@"Hi...");
}

I never see the log message.

I have assigned the Class with Start method to a view which occupies some part of the screen with the UIviewcontroller class with the nib file.

I want a method to be called everytime the view (subclass of uiview) is visited.

It only has awakeFromNib which is called just the first time. viewdidLoad would have done the trick but its not there by default.

Thanks


Make sure self.lineVar isn't nil when you call Start. If it's failing silently, that's probably the issue. You may have forgotten to connect the lineVar outlet in your NIB.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜