Reputation:
i have done the following...tran is a UIView...doSomething is a methos in UIView.but i cant call that method from viewdidload? any help please?
- (void)viewDidLoad
tran *m_view = [[tran alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:m_view];
[m_view release];
tran *s = (tran *)self.view;
[s doSomthing];
[super viewDidLoad];
}
Upvotes: 0
Views: 496
Reputation: 96984
UIView
should be capitalized to Tran
for readability (class names are capitalized)m_view
to the view controller's view via -addSubview:
subviews
array, and that array contains an object instance of type Tran *
-addSubview:
nor casting via (Tran *)
makes the view controller view of type Tran
.UIView
Tran
's -doSomething
on the view controller's view, because that view is not of type Tran
Upvotes: 1