I have this code in my TabBarItem:
MeuPrimeiroViewController *primeiro = [[MeuPrimeiroViewController alloc] init];
MeuSegundoViewController *segundo = [[MeuSegundoViewController alloc]init];
UITabBarController *tabbar = [[UITabBarController alloc] init];
tabbar.viewControllers = [NSArray arrayWithObjects:primeiro,segundo, nil];
primeiro.tabBarItem.title = @"Primeiro";
UIImage *images = [UIImage imageNamed:@"1.jpg"];
[images drawInRect:CGRectMake(0, 0, 30, 30)];
primeiro.tabBarItem.image = images;
segundo.tabBarItem.title = @"Segundo";
segundo.tabBarItem.image = [UIImage imageNamed:@"2.jpg"];
And the CGRectMake doens't work, and the console give me a messange:
Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextSetAlpha: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextScaleCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextDrawImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Mar 3 20:17:04 MacBook-Pro-de-William.local UITabBarController[1174] : CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
How can I solve it?
UIView drawRect:
or some such, you shouldn't be calling[UIImage drawInRect:]
there. - trojanfoe