i want to click a button to change Views in iphone app . I use this code and it work , but there is 2 warning .
-(IBAction) showSearchFlye:(id)send;
{
NSLog(@"Shoing Search flye");
SearchFlye *search= [[SearchFlye alloc] initWithNibName:@"SearchFlye" bundle:nil];
[self.navigationController pushViewController:search animated:NO];
}
this is the warning message http://hpics.li/fef7ba9 .
and this is the interface of the class SearchFlye
@interface SearchFlye : UIViewController {
}
@end
The application work fine but i dont understand wy i have this warning ? And if it’s correct to do this for changing view ?
thanx
Your warnings should come from not having imported the header file where
SearchFlyeis declared in the .m file whereshowSearchFlyeis defined.The reason why it works is this: compiler does not have information about your class, hence the warnings, but your class is linked in and it contains all the selectors that are needed by the objective-c runtime (which does a dynamic dispatch).
If this is the correct way of changing view, depends on your application UI architecture. If you don’t need a navigation controller or a tab bar, it seems fine to me clicking on a button to move to another view…