After AlertView, tint color of parent view remains grey - uiwebview

I have a parent view controller (CollectionView). When you tap on a cell, the app pushed a WebView. In the ViewDidLoad method, I check to see if an internet connection is available. If there is no internet connection, I display an AlertView that notifies the user about the lack of a network connection. When they dismiss the AlertView and then hit the back buttona and go back to the main view, the UISegmentedControler that was tinted is suddenly grey. If I tap on it, it returns to the correct tint color (one segment at a time). Anyone know how to fix this?

Try this in your app delegate:
window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;

Related

Cosmicmind: how to dismiss floatingViewController / return rootViewController?

toolbarController?.floatingViewController = vc
to floating view controller. As expected, toolbar not showing and screen shows with full size. I want to dismiss back to rootViewController didnt achieve that.
Actually i showed apps in pagetabbar like google play and now i want to show app detail page. When user clicks app icon, app icon will animate and shows detail page and if he wants to, it will dismiss that. I used transition method first (it has animation parameter) but i want to figure out difference between floating usages etc. Is there any showcase ? Thank you for great library btw.
to hide the floatingViewController, set it to nil. There isn't a showcase at the moment. The transition method is for changing the rootViewController. Hope this helps :)

ios7 navigationbar causes EXC_BAD_ACCESS after VC with keyboard shown dismiss

I have a Notes-like app: UITableViewController showing up individual notes by pushing them onto navigation stack.
The problem arises when I have UITextView with the FirstResponder status (keyboard is shown) and I touch Back button. The current view controller is dismissed with the animation as expected, BUT the navigation bar is broken now! If I press any of the bar buttons, it will cause EXC_BAD_ACCESS.
I would say that it was not transitioned properly. The table VC is broken somehow as well, as it may appear empty on further manipulations... Very strange behaviour!
By the way, it did not cause any problems with iOS5 and iOS6, but there I used a custom chevron Back button.
I've checked the standard Notes app and it works like a charm.
What is the trick?
Thanks a lot for your advice!
EXC_BAD_ACCESS means you are trying to access an object that has been deallocated. Best thing you can do to trace this is enabling NSZombie, it will tell you what released object is being sent a message (aka EXC_BAD_ACCESS).
You can get how to enable it from here.
I got it and will try to explain to help somebody else to save their day...
EXC_BAD_ACCESS was raised because UITableViewController was not properly transitioned to during Back pop-animation (its viewWillAppear: and viewDidAppear: method were not triggered at all).
In its turn, the animation was not properly performed, as popViewControllerAnimated: was called twice or even more times: 1) as part of the system Back-button callback; 2) inside textViewDidEndEditing: in case no text was entered.
The solution is to check whether the back button has been pressed before calling popViewControllerAnimated:. The trick is to check if the detail-view controller is still in the navigation stack.
Here is the helper method:
-(void) returnToTheListOfRecords {
self.textView.delegate = nil; // this is to avoid the second call of `textViewDidEndEditing:`
if ([self.navigationController.viewControllers indexOfObject:self.delegate]==NSNotFound) {
// Back button has been pressed.
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}
The problem happens on iOS7 only due to its brand-new animation.

Uimenucontroller controller not responding to touch

I have a uimenucontroller that I am using on a uiwebview. The menu controller works fine on simple text websites however on larger websites i.e. http://www.foodnetwork.com/recipes/giada-de-laurentiis/grilled-chicken-with-basil-dressing-recipe/index.html my custom menu item will not respond to touches. When tapped it highlights blue briefly then back to black, the menu is still displayed and myAction is nevere called. Sometimes if I click rapidly othe menu controller it will respond so I believe it may be something to do with the responder chain and or the size of the web page. I initialize the menu controller as follows:
// in view did appear:
UIMenuItem *item1 = [[UIMenuItem alloc] initWithTitle:#"Item1" action:#selector(myAction)];
[[UIMenuController sharedMenuController] setMenuItems:[NSArray arrayWithObject:item1]];
-(void)myAction
{
//do something
}
Thank you! I have been stumped by this for 2 weeks and am out of ideas...

show a specific view when application returns to foreground [duplicate]

How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this?
Also the order of events I get when I come back on local notification from background is as following:
1. UIApplicationWillEnterForegroundNotification
2. UIApplicationDidBecomeActiveNotification
3. didReceiveLocalNotification
When I come from lock screen:
1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification
Why is this difference and whether there is something else I'm missing?
Thanks
Here's how it was solved. May be it's not the way, but it worked for me. Since my application is voip/audio, it doesn't come to didFinishLaunchingWithOptions... I found out, that iOS uses a cached image from a previous state for animation when it resumes from background or from sleep mode. So the solution is basically to exchange this cached image with my default.png image. I do it in applicationWillResignActive delegate. There I add a modal view with a Default.png picture and dismiss it in applicationDidBecomeActive. This is really in short. Hopefully it will help somebody else with the same problem.
You can provide a custom image that is displayed when launching/resuming from a local notification. Simply set the alertLaunchImage property on your local notification to the name of the correct image.
From the Docs:
The string is a filename of an image file in the application bundle. This image is a launching image specified for a given notification; when the user taps the action button (for example, “View”) or moves the action slider, the image is used in place of the default launching image. If the value of this property is nil (the default), the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the application’s Info.plist file, or falls back to Default.png.
alertLaunchImage

redraw GUI on didreceivelocalnotification when come from lock screen iphone

How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this?
Also the order of events I get when I come back on local notification from background is as following:
1. UIApplicationWillEnterForegroundNotification
2. UIApplicationDidBecomeActiveNotification
3. didReceiveLocalNotification
When I come from lock screen:
1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification
Why is this difference and whether there is something else I'm missing?
Thanks
Here's how it was solved. May be it's not the way, but it worked for me. Since my application is voip/audio, it doesn't come to didFinishLaunchingWithOptions... I found out, that iOS uses a cached image from a previous state for animation when it resumes from background or from sleep mode. So the solution is basically to exchange this cached image with my default.png image. I do it in applicationWillResignActive delegate. There I add a modal view with a Default.png picture and dismiss it in applicationDidBecomeActive. This is really in short. Hopefully it will help somebody else with the same problem.
You can provide a custom image that is displayed when launching/resuming from a local notification. Simply set the alertLaunchImage property on your local notification to the name of the correct image.
From the Docs:
The string is a filename of an image file in the application bundle. This image is a launching image specified for a given notification; when the user taps the action button (for example, “View”) or moves the action slider, the image is used in place of the default launching image. If the value of this property is nil (the default), the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the application’s Info.plist file, or falls back to Default.png.
alertLaunchImage

Resources