Since updating to iOS 7.1, my tab bar images initialize as if they were all active, they are all highlighted on launch. Once I visit each tab, that tab image resets and displays correctly. Has anyone else seen this behavior? Suggestions for work around?
I rolled back my xcode to version 5.0, which the only old version i have and build the app using it. It works perfectly on iOS7.1 device now.
If you have the xcode version 5.0.2 that would be great also.
In my case, as I finally figured out, this issue was caused by setup of appearance protocol on UIView in my style controller which is called at startup.
I had been setting an overall tint color for UIView. It did not apply to the icons in iOS7.0 but that must have changed in 7.1.
My style code:
// Color for buttons and enabled controls
UIView *viewAppearance = [UIView appearance];
[viewAppearance setTintColor:overallTintColor];
I added this to fix:
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor darkGrayColor]];
darkGrayColor is not ideal, I just threw it in there for testing. I tried using nil, as I would like it to just go back to the default as it used to. Giving nil as a color did not have any effect. I suppose I will play with some color values until I get a close match.
Related
Here is my code. This may sound like redundant question but my scenario is different as I am not adding QLPreviewController as a subview but present as a controller.
After downloading from dropbox, I present it like-
self.pdfViewController = [[QLPreviewController alloc] init];
self.pdfViewController.delegate = self;
self.pdfViewController.dataSource = self;
[self presentViewController:self.pdfViewController animated:YES completion:nil];
and I also have QLPreviewControllerDataSource, QLPreviewControllerDelegate listed as the protocol. Besides, it is working if being run in earlier than iOS 10.0.
Please help me.
It looks like iOS 10 has changed the way that QLPreviewController is presented. On iOS 9 when I preview an image by presenting the QLPreviewController modally I see a nice zoom effect and the initial state of the preview is with a black background and the navigation and toolbar hidden. I can tap the image to make the bars visible (which changes the background to white). Tapping again toggles the state.
On iOS 10 the same code results in the white background view appearing and the zoom animation being incorrect (it seems to appear from off the bottom of the screen).
I found that implementing this practically undocumented new data source method for iOS 10 fixed the issue:
- (UIView* _Nullable)previewController:(QLPreviewController *)controller
transitionViewForPreviewItem:(id <QLPreviewItem>)item
{
return [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:MIDPhotoImageRowIndex_Image inSection:MIDPhotoSectionIndex_Image]];
}
The view I return is the same view that previewController:frameForPreviewItem:inSourceView: is using as the reference for the original content's frame (i.e. the image view in my table cell).
The documentation for this delegate method at the time of writing just says "No overview available".
Implementing that method did mean that the previewController:frameForPreviewItem:inSourceView: is now called on iOS 10. I just wish there was a way to default to the original black background without navigation bars.
I want to change the background color of a view within the view controller. Selecting the view and opening the attributes inspector isn't showing that much. Should have an option here for the background.
Tried coding it within the (void)viewDidLoad{} with: self.view.backgroundColor = [NSColor blueColor]; That isn't working either, no object of NSView.
What am I doing wrong? I read that the coding problem probably has something to with the newer version of Xcode. coding issue
This is already questioned and answered in
Best way to change the background color for an NSView
Here the code for OS X
[self.view setWantsLayer:YES];
[self.view.layer setBackgroundColor:[[NSColor whiteColor] CGColor]];
wich xcode version are you using? This is how I change the backgroun color using the attributes inspector in Version 7.1 (7B91b)
I am experiencing some problems with [UIBarButtonItem appearance] for the the back button background image.
Normally (iOS 5 and iOS 6) I was able to set the background image of the back button like this:
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
But at iOS 7 the background image does not appear on the back button. The weird thing is, that the background image actually appears when the back button has been touched once.
I have tried setting the image for all states, to test if iOS 7 was using some kind of new state for an untouched back button, but that does not seem to be the case.
Do you have any idea, what I am doing wrong?
A solution which will make the background appear correctly on iOS7 is at OS 7 custom back button. It swizzles a method to fix the Apple bug (which is that they forget to call setNeedsDisplay on the private view when the background image is changed). Going borderless is probably better, if possible, but swizzling does work.
I searched for this problem and found that you are not the only one to have the same problem. There are many others who face the same issue with UIAppearance. These are the proofs (to explain you to your client) :
UIBackButton Background Image not appearing
Back button is not visible in iOS 7
In this case, what you can do is to follow the Answer provided in the 2nd Link.
You can either set the backIndicatorImage property on UINavigationBar to a custom image or you can change the color of the backIndicatorImage by setting the tintColor property on UINavigationBar.
You can create a custom UIBarButtonItem and manually assign it as UINavigationItem's leftBarButtonItem.
try to change the tint color of the button. There is some issue in iOS 7 for UIBarButton
I implemented a really nice solution that works under ios5+ here:
Back button item strangely disappearing under iOS7
To work with ios7 you need to use
UIImage *backButton = [[UIImage imageNamed:#"icon_back" resizableImageWithCapInsets:UIEdgeInsetsZero];
if ([UINavigationBar instancesRespondToSelector:#selector(setBackIndicatorImage:)]) {
[[UINavigationBar appearance] setBackIndicatorImage:backButton];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backButton];
}else{
//ios 5 and 6 code
}
been googling this one for a good bit and i'm totally at a loss.
i'm porting to ios7 an app i built with a mapview with basic system annotations. everything is working great, the annotations are handling taps and acting as they're supposed to - but for some reason, there's no disclosure button appearing in the annotation. i haven't changed anything for prior ios7 releases and all the searching i've done has given me very little.
i've looked through changelogs and googled everything i can possibly come up with to solve this problem, and nothing has even remotely helped.
for my annotation view (which presented the old typical blue arrow button previously) i simply have …
UIButton* rightButton = [UIButton buttonWithType: UIButtonTypeDetailDisclosure];
pinView.rightCalloutAccessoryView = rightButton;
which looks right and should be right (again, it's fine in ios6 and before) be for some reason, any sort of representation of a button is just not appearing.
thanks for any help here.
hahah oh jeez, this is why i shouldn't be working so late.
the default color of the disclosure button is apparently white. like the default annotation background color.
derp.
I had the same problem and hopefully this can help someone else looking here, I didn't seem to require this for the disclosure indicator to appear before iOS7, but I forgot to set the mapView delegate. Once I added this to the viewDidLoad, my indicators started to appear (even though the annotations were appearing without it):
mapView.delegate = self;
I try to set UILabel as titleView using [self.navigationItem setTitleView:musicArtist]; method, but it works strange with different iOS versions. UINavigationBar is in UIPopoverController.
Here is iOS 4.3 screenshot:
As you can see it looks good. But when I switch iOS simulator at iOS 5.x I receive another result:
UILabel AutioSize settings are:
And finally If I change UILabel AutoSizing to this:
I receive this result at both iOS versions:
Where could be the problem and how to get first result at all iOS versions?
Problem solved when I've removed all AutoResizing settings.
Did you check to use the origin x and y like {0, 0}? In the screenshots you are using y=131 so when you attach it to titleView it will not show.