iPhone Add View using another View
I have a tabbar application with individual views.
So I have three views:
MainWindow.xib (tab click) Favorites.xib (button click) AddFavorites.xib
How would I get the Button click to work on the favorites?
Here is my current code and it always crashes.
#import "FavoritesView.h"
#import "FavoritesAddView.h"
@implementation FavoritesView
@synthesize favAddView;
-(IBAction) addButton:(id)sender
{
if (self.favAddView == nil)
{
FavoritesAddView *fView = [[FavoritesAddView alloc]initWithNibName:@"Favorites" bundle:nil];
self.favAddView = fView;
[fView release];
}
[super.view addSubview:favAddVi开发者_开发百科ew.view];
}
It gives me an error at the line: [super.view addSubview:favAddView.view];
Error: Program received "SIGABRT"
Probably the last line should be [self.view.superview addSubview:favAddView.view]
.
精彩评论