Append custom UIMenuItems at the beginning of UIMenuController iOS - ios

I have implemented a custom UIMenuController with two aditional options besides the ones that are set by default in iOS (cut, copy, look up, share). I want to keep these standard options, but I want them to appear after my two custom items, does anyone know how to achieve this in an efficient way? Thanks in advance.

The UIMenuController documentation says:
Custom items appear in the menu after any system menu items.
So there is probably no approved way around that. It appears to be baked in functionality.

Related

Xamarin Forms iOS - PickerView with Multi Row Selection

I am using Picker for displaying the items,I want to select multiple rows in picker, is there any way to achieve this in Xamarin Forms shared code or through rendering? any suggestion or idea would be much appreciated.
Thanks.
I don't would use Picker for multilselection.
You can do this with a ListView (100% XF-Code).
I have posted some code some time ago in the XF-forum:
http://forums.xamarin.com/discussion/17885/multiselect-listviews
If you have to show the "Multiselect-ListView" from a ScrollView, you may also be interested to use the PopUp-Control (XLabs):
https://forums.xamarin.com/discussion/33587/how-to-use-a-listview-in-a-scrollview-with-xlabs-popup-control#latest
And finally, if you want to install the XLabs-NuGet, a further posting to XLabs may help you (search for "How to install, setup and use XLabs" in the XF-forum).
As i don't have more than 10 rep-points here, I am not able to post more then two links :-)
Hope this helps...
No there isn't.
The Picker Class, has SelectedIndex property, but no SelectedItems collection. Also, the native control under the hood on iOS doesn't support selecting multiple rows and I don't think the Android or Windows one do either.
You could create use a Custom Renderer if there was a native control you wanted to use. But, it would probably be easier to use a ListView control and add some events and style it to look and behave like you want.

Custom UIActivityViewController with Background and Items

Does anyone have any suggestions on how to make a custom UIActivityViewController. I saw this one in the Litely app:
and really like it. It has a "night theme". So how do I change the background color and how can I add custom items to it? Thanks!
You cannot customize the existing iOS widget. If you want a custom one, you must build a custom one.
Here is one of many open source implementations on GitHub.

The Correct Way to do Custom Keyboards in iOS?

I am looking to implement a custom toolbar that sits above my keyboard for a text field with some custom values. I've found a ton of tutorials online but this question is for asking what's the best way to do this.
This tutorial here http://blog.carbonfive.com/2012/03/12/customizing-the-ios-keyboard/ provides the most common way I can see across many tutorials, with creating a new subclass of UIView and using delegates to get that information across.
That's the commonality. However, I came across this tutorial which in the view controller itself just creates the toolbar, assigns it to the textField inputAccessory and it's good to go. In fact, I tried out the code and without any effort, I have now a custom keyboard.
http://easyplace.wordpress.com/2013/03/29/adding-custom-buttons-to-ios-keyboard/
This just seems a bit too easy to me though and I'd think the proper, Apple recommended way would be to create that UIView subclass and use delegates so that the view controller with the text fields acts as that delegate.
I'm specifically targeting iOS 7 in my app.
What are people's thoughts on this? If the second easier link is supported and is likely to pass Apple's guidelines, it's a good starting point but if delegates are the way to go, I'd rather look into that from the start.
Your thoughts will be appreciated.
There is no 'Apple Approved' way to do this, and its hard to believe anything you do here would get your app rejected. The custom keyboard you reference in your post has the iOS6 look and will appear outdated in an iOS6 app. I'll mention some iOS7 suggestions shortly, but the constant danger of mimicking what the System looks like today is guaranteed to look outdated later. In Mac/Cocoa development, Apple use to say at the WWDC that if you did something custom, make it look custom, don't take a standard Apple widget and try to duplicate it. But that advice is mostly ignored.
For iOS 7, you can create buttons that appear just like the system ones do (not pressed), but of course when someone presses them, they won't act like system buttons (i.e. animate up and "balloon" out.
I'm currently using a fantastic add-on keyboard, my fork of KOKeyboard (which uses the buttons above). This is such a cool addition. While the buttons look like iPad buttons, each one has 5 keys in it. By dragging to a corner you select one of the four, and tapping in the middle gives you that key. This might be overkill for your app, but it really helped me with mine. It looks like this:
(the Key / Value is in the under laying view.) The center control lets you move the cursor - its like a joy stick - and can be used to both move and select text. Amazing class, I wish I'd invented it!
Also, for any solution, you want to use a UIToolbar as the view holding the keys, for the reason that it supports blur of the view it overlays, just like the keyboard does. You can use the UIToolbar with no bar button items in it (if you want), and just add subviews. This is a "trick" I learned here, as there is no other way to get blur!
David's KOKeyboard (er…, the one he used - see David's comment below) looks nice. I suspect that he is using the official Apple mechanism:
inputAccessoryView
Typically, you'd set that value on a UITextView, but it can be any class that allows itself to become the first responder.
The provided view will be placed above the default apple keyboard.
It is correct that there is no official mechanism (and it is suggested against) to modify any system provided keyboard. You can add to it, as above. You can also entirely replace it for with your own mechanism. Apply will forgo the keyboard setting on your view and use a custom input mechanism if you set
inputView
set it to any view - Apple will still manage its appearance and dismissal as it does the custom keyboards.
Edit: Of course, iOS 8.x added significant access to keyboards. (not mentioned here)

Sticky buttons on iPhone program

Hullo,
I have an app view rather crowded to insert the necessary switches in order to toggle 6 values associated to icons. So I would have appreciated if it were possible to make them sticky buttons, namely to have them independently keep the pressure when clicked in order for me to read the ones in that state when exiting the view.
I read there exists such a technique for Mac but that does not translate to iOS. Hw could I do that?
Thanks, Fabrizio
It sounds like you're looking for a checkbox functionality. Have the button change images when it's pressed, then use that to determine its state.
I'm on my phone so this took a bit, but here's a link to how to make a checkbox in objective-c What is the best way to make a UIButton checkbox?
Note that you don't need to use normal checkbox images.

Ipad Checkboxes

How do I use checkboxes in iPad application development?
I want to use this for users to answer questions like:
1.Is the Up Photocell operational?
Yes
No
Then output the results to another page.
I've tried some google searches, with nothing.
Anyone?
The UIKit user interface in iOS doesn't use checkboxes, it uses the UISwitch control.
There is no checkbox control.
There is no standard checkbox provided by Apple but there are some opensource solutions. Checkout: http://cocoacontrols.com/platforms/ios/controls/radiobutton
There are other solutions out there too but that is one.
You may want to make your own if UISwitch isn't what you want. Just subclass a UIImageView and put a UITapGestureRecognizer on it. Every time it is tapped it switches the image and flips a BOOL variable.

Resources