I have a UIActionSheet and when it displays it darkens the main view behind it, I am under the impression this is default behavior for an action sheet. My question is, how do I override this behavior to leave the main screen the same tint as it normally is? I'm assuming I do something like:
mainView.alpha = 1f;
Or something...I can't remember if alpha needs to be maxed or 0 to leave a screen with the same coloration/transparency. Anyways, if that is correct where should it happen? My action sheet is being called in place of a keyboard for a UITextField.
Thanks in advance.
You can't change this behavior. UIActionSheet is actually presenting a whole new view overtop of your view. It's this additional view that adds the tint. There is no API to change this.
Your best solution is to implement your own custom equivalent to UIActionSheet so it does exactly what you want.
Related
I have created a custom accessory view to supplement the standard Apple alpha iOS keyboard.
The purpose is to add a line of numeric keys to prevent flipping back and forth between keyboard views. At first, I created a toolbar and loaded it with a set of 0 - 9 titled buttonItems and it functioned quite well. However, it looked terrible, not at all like the alpha keys despite adding a rounded rect background image to each key because the system apparently prevents customizing font size and button spacing inside the stack view of the toolbar. Therefore, I created a UIView xib and loaded it with a stackView full of customized numerical buttons. When I add the UIView as the accessory view it looks pretty darn close to the rest of the Apple Alpha keyboard. The issue now is that the touch-up events go to the UIView class of the accessory view. Is there a clever, efficient way to have the button presses in the accessory emulate the std keyboard feeding into TextField: shouldChangeCharactersIn? I could package the button presses into a local notification event to get it into the class holding the textField but that seems terribly inelegant! Any suggestions would be greatly appreciated. Stay Safe!
Not the best answer, but I did implement notification on key button press with an observer in the main view class. The observer does a TextField.insertText which is suboptimal since I will need to refactor the several hundred lines of code that performs real-time language translation in the shouldChangeCharacters methods. Ah well.
I would like to add "more info" collapsible accordion into my error alert view. So it will expand with additional information about the err after user presses it. And of course it will animate the size of error alert too. How it can be done? Maybe there is already existing solution for what I need?
Thanks a lot!
The standard UIAlertView does not allow this. You'll have to make your own view that mimicks the appearance of an alert view (using a UIVisualEffectView and possibly even a UIInterpolatingMotionEffect if you really want it to look like the real thing). Takes a fair but of work, especially if you want to support older iOS versions. And of course with every new iOS version that changes the appearance of alerts, you'll have to update the code. You might be better off just going with a completely different appearance unique to your app.
Once you have made that custom view, you can add the extra field as a hidden text field. When the triangle button is pressed, you set the height of that hidden field to 0, unhide it, then animate the height of the text field and the height of the containing view to their new values.
Try this custom alert view
https://github.com/wimagguc/ios-custom-alertview
You can add whatever animation you want.
I have a toolbar that, at some point in the application, is completely replaced by another toolbar (i.e. another set of toolbar items). How do I animate this replacement?
Note: An ideal animation would be that of sliding the old toolbar items out and sliding the new ones in.
I found the best way to do this is to use setToolbarItems:animate: on the active view, thus avoiding the need for another toolbar.
Please check this,
http://www.iphonedevsdk.com/forum/iphone-sdk-development/25045-navigation-controller-custom-animation.html
There is also a UIToolbar method that is called - (void)setItems:(NSArray *)items animated:(BOOL)animated which does the same as the one mentioned by nessup.
I know I can access a individual button on a actionSheet using a for loop to access the particular button in the action sheet I want, but the thing is, how would I make a green button?
I know each button acts almost identically to a UIButton so how should I go upon making one of my buttons in the action sheet green?
I just need some tips or help with this as it is the last part of my app that isn't done!
Thanks!
When I have needed customizations for UIActionSheets, sometimes I find methods to make it happen simply, but more often I end up having to set up a custom view on way or another. I've added all manners of custom controls with:
[sheet addSubview: myCustomActionSheetController.view];
You might need to set the size as well.
I am developing an iPhone application in which I want to customize the action sheet with my own background image for action sheet and buttons.
I can write my own view which behaves like UIActionSheet. But, UIActionSheet by itself has some standard behavior like blocking orientation events. We might not be aware of such things. So, for safety purpose, it is better to have UIActionSheet itself; by replacing all its views with my custom view.
For this I have done the following things:
1. Create UIActionSheet. Call showOnView: on that action sheet.
2. Set the delegate as myController
3. In the delegate method willPresentActionSheet: remove all the subviews and add my custom view as action-sheet's sub-view
The problem is that I cannot get the animation affect of Action Sheet with my custom view, Because,UIActionSheet is animated before calling willPresentActionSheet (in showInView). If I override showInView and add my own animation I might miss the behavior like:
1. Blocking orientation events
2. Some of the views (the argument of showInView:) might no support orientation. I should be able to apply same orientation to my action-sheet in showInView.
Could someone help me out in achieving customization?
Thanks and Regards, Deepa