iOS 7.1: UITabBarItems have default color - uitabbaritem

Seems that this line does not work correctly after 7.1 update anymore:
NSDictionary *tabBarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:0.059 green:0.737 blue:0.596 alpha:1.0], NSForegroundColorAttributeName, nil];
[[UITabBarItem appearance] setTitleTextAttributes:tabBarTitleTextAttributes forState:UIControlStateSelected];

It works for me.
[[UITabBarItem appearance] setTitleTextAttributes:#{NSForegroundColorAttributeName : [UIColor redColor]} forState:UIControlStateSelected];
My setup
iPhone 4s
XCode 5.1
iOS 7.1

Related

Xcode - crash opening camara on ipad

My iphone app use camara to take photo.
Installing the app on ipad, the access to camara make the app crash.
Someone knows if any difference exists on use the picker controller between iphone and ipad?
Tx in advance
---EDIT---
he codeo that thaht call the camara I using is:
- (void) showCamera{
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.allowsEditing =YES;
[self presentViewController:imagePickerController animated:YES completion:nil];
}

Admob banner not filling up full screen

My app was just released the other day. When I downloaded it to an iPhone 6 I noticed the admob banner didn't fill the full screen (look at the attached picture). The banner works fine on an iPad and iPhone 5 but isn't working correctly on the iPhone 6.
Here is my code I am using for the banner:
_bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
_bannerView_.frame = CGRectMake(0.0,
self.view.frame.size.height -
_bannerView_.frame.size.height,
_bannerView_.frame.size.width,
_bannerView_.frame.size.height);
_bannerView_.adUnitID = #"ID";
_bannerView_.rootViewController = self;
GADRequest *request = [GADRequest request];
[_bannerView_ loadRequest:request];
[self.view addSubview:_bannerView_];
Does anyone see any problems or know how to fix this problem? Thanks in advance
I used below code to create Admob Banner. It worked fine in iPhone6 also.
-(void)createBannerAds
{
//set up banner coordinates to display at the bottom
CGPoint origin = CGPointMake(0.0,self.view.frame.size.height -kGADAdSizeSmartBannerPortrait.size.height);
self.adBanner = [[[DFPBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait origin:origin] autorelease];
self.adBanner.adUnitID = ADMOB_ID;
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
GADRequest *request = [GADRequest request];
request.testDevices = #[#"600ecccd6a1c2a4750952facf253ea2f"];
[self.adBanner loadRequest:request];
}

how to change window color on mac os

mac os: 10.10
xcode:6.1
I got a "default cocoa program" by Xcode. and I want to change the window color...after researching, I did the following code in AppDelegate.m:
NSWindow *myWindow;
NSColor *semiTransparentBlue =
[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:0.5];
[myWindow setBackgroundColor:semiTransparentBlue];
but window color not changed...
1: how to change the window color on mac os?
2: no NSWindow in "Default cocoa program" by Xcode, why will get a window?
thank your very much.
i tried some functions...but failed..following is the detail:
(void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
//compile success but the window's color is not changed.
[[NSApplication sharedApplication] keyWindow].backgroundColor = [NSColor redColor];
//or the following two got compiled error
self.view.backgroundColor = [UIColor redColor];
self.window.backgroundColor = [UIColor redColor];
}
in your app delegate juste type this :
self.window.backgroundColor = [NSColor whiteColor];

Crash on iOS6 presentViewController: but not on iOS5

This code is crashing when i run my app on iOS6 Simulator with Xcode 4.5 GM Seeds:
if ([[[UIDevice currentDevice] systemVersion] isEqualToString:#"6.0"]) {
XLog(#"hier checken");
self.tabBarController = [[UITabBarController alloc] init];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
}
[...]
self.loginController = [[[LoginController alloc] initWithNibName:#"LoginController_iPhone" bundle:nil] autorelease];
self.loginController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//this line occurs a crash on iOS 6 (simulator, device not tested)
[self.tabBarController presentViewController:self.loginController
animated:YES
completion:nil];
The crash is a SIGABRT. no more information about the crash.
what is occuring this crash on iOS6?
initWithNibName:bundle: is the designated initializer for a UIViewController,and there is something new in iOS6 .
You can try to modify your LoginController_iPhone.xib and remove its controller :
---->
It works for me .
hope this helps.
An app i was working on, would crash without any trace when I was trying to access the address book. ABAddressBookRef or ABAddressBookCreate with the permission for your app to access Contacts turned off, will crash the app. Hope this helps!

NSUserdefaults works on Simulator but not on Device

I would like to save an NSArray to NSUSerDefaults. If I do it on Simulator everything works, if I do it on Device, it doesnt work.
NSArray *Test1 = [Daten copy];
NSArray *Test2 = [Kosten copy];
[prefs setObject:Test1 forKey:#"Daten"];
[prefs setObject:Test2 forKey:#"Kosten"];
I am using the above code.
prefs is a normal NSUserDefaults, like NSUserDefaults *prefs = [NSUserDefaults standartUserDefaults];...
Daten & Kosten are Mutable Arrays, to work with.
Everything works on simulator, but on device it doesnt work...
Does anybody have an idea?
Are you synchronizing them after settings/updating ?
[[NSUserDefaults standardUserDefaults] synchronize];
Because Saurabh asked me to post my solution, I will do it for other readers.
My Problem Code was the following:
[derText1 resignFirstResponder]
[derText2 resignFirstResponder]
NSArray *Test1 = [Daten copy];
NSArray *Test2 = [Kosten copy];
[prefs setObject:Test1 forKey:#"Daten"];
[prefs setObject:Test2 forKey:#"Kosten"];
This worked on an iPhone 4 Simulator with XCode 3.2.5 but not on my Device with iOS 5.x installed.
So I have downloaded and installed the newest XCode version from Apple.
After that it also doesnt work with the Simulator too. It looks like the problem is only with iOS 5 Software.
Than I changed my code simply to that:
NSArray *Test1 = [Daten copy];
NSArray *Test2 = [Kosten copy];
[prefs setObject:Test1 forKey:#"Daten"];
[prefs setObject:Test2 forKey:#"Kosten"];
[derText1 resignFirstResponder]
[derText2 resignFirstResponder]
And it worked on Device and Simulator with the latest iOS. Take a look at the position of the resign First Responder Entrys. They seem to have to be after the saving. I don't know why, but it works.
NSArray *Test1 = [Daten copy];<p>
NSArray *Test2 = [Kosten copy];<p>
NSUserDefaults *prefs;<p>
prefs= [[NSUserDefaults standardUserDefaults]setObject:Test1 forKey:#"Daten"];<p>
[[NSUserDefaults standardUserDefaults] synchronize];
prefs= [[NSUserDefaults standardUserDefaults]setObject:Test2 forKey:#"Kosten"];<p>
[[NSUserDefaults standardUserDefaults] synchronize];

Resources