DaffodilGirl 2013-03-11 06:33 采纳率: 0%
浏览 2505
已采纳

模拟器ios4.3中应用崩溃

应用在ios5.1和ios6.1中运行正常,但是放到ios4.3中就崩溃了。

出问题的代码:

[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"home-active.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"home-normal"]];

代码实现设置TabBar的图片。
log:

2013-03-08 15:16:27.688 GrandNatural[3372:12c03] -[UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:]: unrecognized selector sent to instance 0x628c090
2013-03-08 15:16:27.690 GrandNatural[3372:12c03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:]: unrecognized selector sent to instance 0x628c090'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x019785a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x016e7313 objc_exception_throw + 44
    2   CoreFoundation                      0x0197a0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x018e9966 ___forwarding___ + 966
    4   CoreFoundation                      0x018e9522 _CF_forwarding_prep_0 + 50
    5   GrandNatural                        0x0000f8fe -[HomeViewController initWithNibName:bundle:] + 535
    6   GrandNatural                        0x00002985 -[GrandNaturalAppDelegate application:didFinishLaunchingWithOptions:] + 262
    7   UIKit                               0x00ce5c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    8   UIKit                               0x00ce7d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    9   UIKit                               0x00cf2617 -[UIApplication handleEvent:withNewEvent:] + 1533
    10  UIKit                               0x00ceaabf -[UIApplication sendEvent:] + 71
    11  UIKit                               0x00ceff2e _UIApplicationHandleEvent + 7576
    12  GraphicsServices                    0x021dd992 PurpleEventCallback + 1550
    13  CoreFoundation                      0x01959944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    14  CoreFoundation                      0x018b9cf7 __CFRunLoopDoSource1 + 215
    15  CoreFoundation                      0x018b6f83 __CFRunLoopRun + 979
    16  CoreFoundation                      0x018b6840 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x018b6761 CFRunLoopRunInMode + 97
    18  UIKit                               0x00ce77d2 -[UIApplication _run] + 623
    19  UIKit                               0x00cf3c93 UIApplicationMain + 1160
    20  GrandNatural                        0x00002856 main + 132
    21  GrandNatural                        0x00002795 start + 53
)
terminate called throwing an exception(lldb) 
  • 写回答

2条回答 默认 最新

  • redCoral_ 2013-03-11 07:44
    关注

    用下面的代码设置tabbar的图片

    if ([[[UIDevice currentDevice] systemVersion] floatValue]<5.0)
        {
    
            self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"your name" image:[UIImage imageNamed:@"home-normal"] tag:0];
    
        }
        else
        {
            self.tabBarItem = [[UITabBarItem alloc] init];
            self.tabBarItem.title = @"your name";
            [self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"home-active"] withFinishedUnselectedImage:[UIImage imageNamed:@"home-normal"]];
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献