以下代码使用了arc后,切换视图的时候会报错:progran received signal:"exc_bad_access"关闭arc后,正常切换,请问这是什么问题,哪里错误了? 请指点迷津,谢谢- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
//生成各个视图控制器
a* aa = [[a alloc]init];
b* bb = [[b alloc]init];
c* cc = [[c alloc]init];
d* dd = [[d alloc]init];
e* ee = [[e alloc]init];
//加入一个数组
NSArray* controllerArray = [[NSArray alloc]initWithObjects:aa,bb,cc,dd,ee ,nil];
//创建UITabBarController控制器
UITabBarController* tabBarController = [[UITabBarController alloc]init];
// 设置委托
tabBarController.delegate = self;
//设置UITabBarController控制器的viewControllers属性为我们之前生成的数组controllerArray
tabBarController.viewControllers = controllerArray;
//默认选择第1个视图选项卡(索引从0开始的)
tabBarController.selectedIndex = 0;
//读取
UIViewController* activeController = tabBarController.selectedViewController;
if(activeController == aa){
//
}
// 把tabBarController的view作为子视图添加到window
[self.window addSubview:tabBarController.view];
//定制按钮
/*NSMutableArray* customzableViewControllers = [[NSMutableArray alloc]init];
[customzableViewControllers addObject:musicList];
[customzableViewControllers addObject:currentPlay];
[customzableViewControllers addObject:favourite];
tabBarController.customizableViewControllers = customzableViewControllers;
tabBarController.customizableViewControllers = nil;
*/
//
// [musicList release];
// [currentPlay release];
// [favourite release];
// [singerList release];
// [settings release];
[self.window makeKeyAndVisible];
return YES;
}
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
//生成各个视图控制器
a* aa = [[a alloc]init];
b* bb = [[b alloc]init];
c* cc = [[c alloc]init];
d* dd = [[d alloc]init];
e* ee = [[e alloc]init];
//加入一个数组
NSArray* controllerArray = [[NSArray alloc]initWithObjects:aa,bb,cc,dd,ee ,nil];
//创建UITabBarController控制器
UITabBarController* tabBarController = [[UITabBarController alloc]init];
// 设置委托
tabBarController.delegate = self;
//设置UITabBarController控制器的viewControllers属性为我们之前生成的数组controllerArray
tabBarController.viewControllers = controllerArray;
//默认选择第1个视图选项卡(索引从0开始的)
tabBarController.selectedIndex = 0;
//读取
UIViewController* activeController = tabBarController.selectedViewController;
if(activeController == aa){
//
}
// 把tabBarController的view作为子视图添加到window
[self.window addSubview:tabBarController.view];
//定制按钮
/*NSMutableArray* customzableViewControllers = [[NSMutableArray alloc]init];
[customzableViewControllers addObject:musicList];
[customzableViewControllers addObject:currentPlay];
[customzableViewControllers addObject:favourite];
tabBarController.customizableViewControllers = customzableViewControllers;
tabBarController.customizableViewControllers = nil;
*/
//
// [musicList release];
// [currentPlay release];
// [favourite release];
// [singerList release];
// [settings release];
[self.window makeKeyAndVisible];
return YES;
}
解决方案 »
- xcode 如何读取远程得xml
- 急求用Objective-C编写的计算器代码,高手请进......
- [抓狂]读写文件还是想要用FILE,不习惯NSData,NSFileHandle。。。。。
- cocos2d js音效的问题
- 使用ZXingObjC出现Duplicate interface definition for class错误
- TableView无法点击最后一行
- iOS开发中unrecognized selector sent to instance的问题
- iOS推送通知获取不到deviceToken
- 为何按钮的背景图片不能占据整个按钮呢
- 求助企业证书续费后,如何操作???
- PhoneGap 插件 EmailComposer 的问题
- iPhone socket 编程
自己管不了autorelease-----对象只能被创建,销毁不受控制。至于为什么,在此不赘述,查阅相关资料。