上代码了。
blueViewController = [[BlueViewController alloc] init];
yellowViewController = [[YellowViewController alloc] init];
NSMutableArray *viewControllerArray = [NSMutableArray arrayWithCapacity:3];
[viewControllerArray addObject:blueViewController];
[viewControllerArray addObject:yellowViewController];
tabBar.viewControllers = viewControllerArray;
[self.view addSubview:tabBar.view];
为什么我用NSMutableArray程序就莫名其妙的退出了?而且控制台也没有报任何错误。
换成NSArray *viewControllerArray = [NSArray arrayWithObjects:blueViewController,yellowViewController,nil];就完全正确。
NSMutableArray不是NSArray的子类么?从面向对象继承的角度看,是没有任何问题的呀!为什么程序中止了?还不报错。。
blueViewController = [[BlueViewController alloc] init];
yellowViewController = [[YellowViewController alloc] init];
NSMutableArray *viewControllerArray = [NSMutableArray arrayWithCapacity:3];
[viewControllerArray addObject:blueViewController];
[viewControllerArray addObject:yellowViewController];
tabBar.viewControllers = viewControllerArray;
[self.view addSubview:tabBar.view];
为什么我用NSMutableArray程序就莫名其妙的退出了?而且控制台也没有报任何错误。
换成NSArray *viewControllerArray = [NSArray arrayWithObjects:blueViewController,yellowViewController,nil];就完全正确。
NSMutableArray不是NSArray的子类么?从面向对象继承的角度看,是没有任何问题的呀!为什么程序中止了?还不报错。。
解决方案 »
- ios scrollview怎么显示从tableview点击进来的数据
- 求助UITextView能否实现文本的选取不是从头开始的方式?
- C#和Objective-C MD5加密的问题
- iphone开发环境的建立必须使用mac机器吗 ?
- iOS 蓝牙通讯不需要MFi认证方式
- 谁帮我编一个ios程序?
- 我的第一款个人应用:小纸条 - 蓝牙聊天室,无需互联网
- UIViewController如何改成UIStrollView
- 请问这个app的导航栏如何实现,请高手给点思路。多谢!
- 怎么全局设置导航栏
- 如何用scons生成v8的可以正确device release 编译的库
- 新手求教iphone开发执行sql语句的问题。
{
NSMutableArray *controllerArray = [[NSMutableArray alloc] init];
UINavigationController *navigationController;
ConfigurationManagement* configurationManagement = [[ConfigurationManagement alloc] init];
navigationController = [self setUINavigationController:configurationManagement
withTag:0
withImageName:@"setting.png"
withTabBarTitle:ConfigurationManagementString];
[controllerArray addObject:navigationController];
[navigationController release];
Conferencing* conferencing = [[Conferencing alloc] init];
navigationController = [self setUINavigationController:conferencing
withTag:1
withImageName:@"meeting.png"
withTabBarTitle:MultMeetingString];
[controllerArray addObject:navigationController];
[navigationController release];
ProvisionalMeeting *provisionalMeeting = [[ProvisionalMeeting alloc] initWithNibName:@"ProvisionalMeeting" bundle:nil];
navigationController = [self setUINavigationController:provisionalMeeting
withTag:2
withImageName:@"tmpcall.png"
withTabBarTitle:ProvisionalMeetingString];
[controllerArray addObject:navigationController];
[navigationController release];
CallRecords *callRecord = [[CallRecords alloc] init];
navigationController = [self setUINavigationController:callRecord
withTag:3
withImageName:@"callhistory.png"
withTabBarTitle:CallRecordsString];
[controllerArray addObject:navigationController];
[navigationController release];
tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:controllerArray animated:NO];
[window addSubview:tabBarController.view];
[configurationManagement release];
[conferencing release];
[provisionalMeeting release];
[callRecord release];
[controllerArray release];
}
你在[self.view addSubview:tabBar.view];后面,把所有该release的对方都叫上release,
你的方式,就是面向对象的理论也是错的,因为对象一定要有回收的,而java,C#有自动回收你可以不管,但是Objective - c是没有的自动回收机制的,
现在不是内存回收的问题,“你的方式,就是面向对象的理论也是错的,因为对象一定要有回收的,”请问你从哪本书里看到的??我就奇怪了,你自己懂不懂什么叫面向对象啊??它只是一种思想,与对象回不回收有屁关系啊。自己读think in c++去。
c++ 是可以的,为什么object c 不行,求答案