2

I'm new to iOS development. I face some difficulty finding the right resources for having custom keyboard shortcut for my app. I know that in ios 5 it has been developed. but i think i would like to have a custom keyboard shortcut for the frequently phrase that only work in my app.

So please please help me..

I also wonder how can I control the size of the font for the whole app? It is easy to do it with one label. I mean when the user change the font size with a UISlider for one label, how can I apply the change for every text box, label , table view controller ... etc.

In addition, in this Add shortcut in keyboard settings through app?

if I have to work with UITextChecker, is there any way I can make my own dictionary to retrieve the data from core data?

Any help will be appreciated!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Hanouf D.
  • 49
  • 1
  • 10

1 Answers1

2

Three questions in one, wow. So let's start:

Custom Keyboard Shortcuts: To recap your feature... Do you want to have own text-replacement blocks in your App? Such as the text replacement for brb into be right back? If so, I would recommend using a dictionary, such as:

NSDictionary replacement = [NSDictionary dictionaryWithObjectsAndKeys:@"be right back",@"brb",@"see you",@"cu",nil];

Aftewards you may iterate over each entry, replacing the text in your text box:

NSString text = @"Hello. brb... cu";
for(NSString* key in [replacement allKeys])
    text = [text stringByReplacingOccurrencesOfString:key withString:[replacement valueForKey:key]];

Font Size Control: Two ideas here. The first one, would be to create a public property in any of your classes (e.g. your AppDelegate class) called fontScale (type CGFloat). Starting with iOS 6 you have the possibility to set the minimumFontScale property to all text fields/boxes like this:

textField.minimumFontScale = [[UIApplication sharedApplication] delegate].fontScale;

My second idea, would be to subclass UITextField/View and set the font size in the init-methods using your globally stored font-size.

Dictionary in Core Data: Please see here.

Community
  • 1
  • 1
Kristian Kraljic
  • 826
  • 12
  • 11
  • Thank you..Thank you..Thank you.. You really do help me here..i just try the idea for "Control the Font Size" and i wonder why the statement here [[UIApplication sharedApplication] delegate].fontScale; didn't work out unless i make an object of the AppDelegate class then use it like that.. AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];.. Again, thank you so much. :) – Hanouf D. Oct 29 '12 at 03:55
  • Hello Hanouf, yes you are right. I forgot, you will have to parse the AppDelegate interface to your class using #import "AppDelegate.h" AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; – Kristian Kraljic Oct 29 '12 at 19:03