uiswitch default text change - iphone

I am trying to use a UISwitch controller but set its default text to "Yes/No" instead of "On/off". What is the easiest way to do that? Well is it doable?

Unfortunately in german language, but the source code is readable and it works well:
http://www.mobile-dev.de/iphone-code-schnipsel/34-iphone-user-interface/192-aendern-des-textes-von-uiswitch-elementen.html
But you should read the documentation:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UISwitch_Class/Reference/Reference.html
The UISwitch class is not customizable.
I do not know if it is allowed and you will get trouble in the Apple approval process.

Related

How to customise the default keyboard in Xcode 5

when we click the text field, the default keyboard or keypad not to be appear instead i need to display the custom keyboard..
Did any one know the answer please post it..
Declared in
UIResponder.h
UIInputViewAudioFeedback protocol.
Is this method correct or else there having any simple method to work out?
You need to create a protocol for this for having a custom keypad appearing throughout the app. I have made it few months back and the stuff was working well. My requirement was to create a keyboard for farsi language, because ios does not have farsi in its language settings.
There is no need to make protocol if you want it in just 1 viewcontroller.
Here is my that thread:
customized keypad on the iPhone Application
Here's something that I created that might help. Just fork it on GitHub and change the Punjabi characters to Myanmar. Most of the hard work is done for you :)
https://github.com/kulpreetchilana/Custom-iOS-Keyboards
Per your comment you need the Number Pad keyboard.
Set your UITextField keyboardType property, either via Interface Builder or programmatically:
textfield.keyboardType = UIKeyboardTypeNumberPad;

Conditionally color portion of the text of the UITextField

I've a UITextField, I need to color some specific word in a gray
Is there a direct solution?
If not, I think If I got the Source code for setTextColor method, try to conditinoally change its implementation (may be through a Category or even subclassing).
It's not possible as is. To implement that kind of feature you have to use CoreText.
For more info read this great tutorial: http://www.cocoanetics.com/2011/01/befriending-core-text/

Iphone SDK, switch keyboard in app

I have one question, may be it is very simple, but I do not know about this nothing...
For example, I have an application, application with textfield, I want to know two things.
First: Is possible to switch keyboard when application in runtime?
Second: how I can switch type of keyboard(Russian, English, Swedish, etc.) in my application*?
*-without going to Settings->General->Keyboard->add new keyboard.
Not sure about changing languages (I did find this other post about it: change input source language programmatically OSx), but changing the keyboard is pretty easy. Here is a one line example:
textField.keyboardType = UIKeyboardTypeURL;
Take a look at the UITextInputTraits protocol reference for more info. Then the question comes in where to implement this. I am assuming that you want to check conditions right before the keyboard comes up, you may have to implement UITextFieldDelegate protocol (and maybe using the field's tag to see which field the cursor is in).
Hope this helps.

Programmatically pasting into an iPhone UITextView

I have an iPhone app with a UITextView. I'd like to be able to paste the clipboard contents into it without showing the UIMenuController.
I tried calling the paste: method on the UITextView, and on the first responder, but neither of those things worked.
I was able to implement this by writing a bunch of code to read text from the clipboard, insert it in the UITextView's text property, and update the selection range. I also added support for undo/redo. But it seems like there ought to be an easier way. Is there?
Did you try paste with nil sender?
[theTextView paste:nil];
as per UIResponder docs
Did you try making the UITextView the first responder?
I checked out the headers to the UITextView object, but I couldn't find any documented method called -paste; also, looking over the NSPasteboard class suggests to me that programatically setting your text was the right way to go.
If pasting text is important to your app, I would consider setting up a class to handle it; maybe even make it a singleton if it was important enough.
Good luck!

MFMailComposeViewController subject changes?

i am using apple's MFmailcomposer.in that when i type subject, the title of MFMailcomposer
is also changing, how can i avoid it?
This is default behavior for the Class. If you want to change it, you should write your own mail controller, or check out the one in Three20. The class you want to start with is TTMessageConposer. You should be able to pick it apart to achieve what you desire.