On iOS7, bar button item icons vanished in input accessory view - ios7

Moving my app from iOS6.1 to iOS7, all the button that were visible under iOS6.1 in the toolbar I created for the Input Accessory View of the keyboard are not visible anymore (but still active).
I tried all combinations of [myBar setTranslucent:...] and [myBar setBarStyle:...] but no way to make these buttons visible again. They are defined as:
UIBarButtonItem *myButton =[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:#"myImage.png"] style:UIBarButtonItemStylePlain target:self action:#selector(mySelector:)];
<-iOS 7.1
<-iOS 6.1
Any idea? Thanks!

I found the solution of my problem.
The method I used to remove the standard input accessory view of the uiwebview was the reason of this problem, it left some view displayed that prevented from seeing the new UIToolbar view. I used the one described here in Stackoverflow and it works.

Related

Iphone uibutton click feel

My problem is I have to change UIButton backgroundcolor on click and navigation controller move to next page.
I don't need to use NSTimer to show button effect.
I need to apply this effect for my application all buttons.
I can't able to make my next view controller to wait for show this effect.
If I understand what you're asking correctly, you want all buttons in your application to instantly change background colors upon a button click. You can do this using the UIButton's appearance.
In short, UIAppearance allows developers to easily keep visuals consistent throughout their applications. For more information on what it is and how to use it, click here.
Here's an example:
//Inside of an IBAction that a button clicks
[[UIButton appearance] setBackgroundColor:[UIColor redColor]];

Get UIBarButtonItem From Detail View Controller

How do you get the UIBarButtonItem that pops out the main menu (when in portrait mode) of the DetailViewController when dealing with a master/detail split view controller? I want to change the title of that button and enable/disable it based on certain actions.
I tried:
self.navigationController.navigationBar.items...
But it doesn't get it for me.
Try: self.navigationItem.leftBarButtonItem

Background image of back button does not appear before it is touched iOS 7

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
}

Interact with other views while a popover is active

I have a toolBar and I have setup two UIBarButtonItem on it. Both UIBarButtonItem are containing UIButtons as their customViews.
I activate a popover for their Touch Up Inside event as below,
[popover1 presentPopoverFromBarButtonItem:buttonItem1 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
I have another UIButton named clearFilters inside the main view. (Also this is the view which is containing the above toolBar.) I have declared a method for clearFilters button's Touch Up Inside event.
My problem is,
I can not interact with the clearFilters button while a popover is active. So, I'm looking for a solution to interact with this clearFilters button, while a popover is active.
I tried by adding passthroughViews property for a popover as below and it do not work as I expect.
popover1.passthroughViews = [NSArray arrayWithObject:clearFiltersButton];
What could be the reason. As the documentation has mentioned I can not see any issue.
I expect if the above things are correct, then the Touch Up Inside event of the the clearFilters button's should be fire up.
So, please show me if there is any issue or a necessary way to work on this thing.
I'm working on XCode4 and iOS 4.3.
Thanks.
The UIPopoverController documentation reveals why the other bar buttons can be tapped while the popover is visible:
“When presenting the popover, this method adds the toolbar that owns the button to the popover’s list of passthrough views.”
Try querying and logging the popover’s passthrough views. Does it already have things in it? Perhaps something like this would work?
myPopover.passthroughViews = [myPopover.passthroughViews arrayByAddingObject:clearFilters];
I haven’t tested this code, but it’s worth a try.

Confusing behavior from UIPopoverController

I'm trying to set up a popover to appear that displays a UIDatePicker when I press a button, however I'm getting some very confusing behavior. I created a view controller that housed nothing but the UIDatePicker, wired one up in the class i needed it in, and added it to a new UIPopoverController like this:
self.timePickerPopoverController = [[UIPopoverController alloc] initWithContentViewController:self.timePickerViewController];
then I present it like so:
[timePickerPopoverController presentPopoverFromRect:prepTimeButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
(prepTimeButton being the button that was pressed). However, I just get the following result:
Instead of it displaying next to the button that was pressed and at the target size (it's way too tall right now; should only be the size of the date picker). I also tried giving it a custom view of the proper location and size in which to display, but that didn't help much (just shifted the popover to the right half of the screen). What am I doing wrong and how do I fix it?
Is self.view the direct superview of prepTimeButton? Perhaps prepTimeButton is nested in a subview, in that case you'd need to use that as the inView: parameter (or convert the coordinates).
Did you set the contentSizeForViewInPopover property of your view controller?
Make sure to set both contentSizeForViewInPopover on the internal view controller and popoverContentSize on the UIPopoverController itself.