so for example i have this in my uiviewcontroller
- (void)loadView {
CGRect frame = [[UIScreen mainScreen] applicationFrame];
MyDetailView *detailView = [[MyDetailView alloc] initWithFrame:frame];
self.view = detailView;
[detailView release];
}
now i add some labels to my view, f.e.
@property(nonatomic, retain) UILabel *descriptionLabel;
if i want to set this in my ViewController i would normally do something like
self.view.descriptionLabel.text = @"foo";
because this would generate a warning i cange it to
[[(MyDetailView*)self.view descriptionLabel] setText:@"foo"];
is there a better way for this? F.E. telling my ViewController that the view attribute is a subclass? is there a way for this or should i save my detail view in an additional ivar?
thanks for your hints!
I don’t believe there’s anything wrong with what you’ve demonstrated. I might write it slightly differently, but that’s probably a matter of preference: