iOS custom keyboard for multiple choice - iphone

I am trying to make an update for my trivia app and want it so that when the user types in the answer he/she only has the option to click A,B,C, or D. Is this possible? and if so, would apple allow this and how do I do it?

You could also just create a custom view with four buttons that appears when necessary. It would be easier than customizing the keyboard, and depending on how you design and implement it, it'll probably look better than an action sheet. UIView provides a rich set of methods to animate views with ease.

Yes, you can customise the keyboard, all the documentation is in the developer library. But it sounds to me you'd be better off using a UIActionSheet if all you are doing is picking from four options.
Edit: For reference, have a look at Custom Views for Data Input in Apple's Text Programming Guide for iOS.

Related

How can you add iOS buttons and features to a Table View based app?

So basically I have made a storyboard based app which consists of table views and text. It is designed to help new programmers like a handbook. You have a table view which allows you to choose a language, a table view which allows you to choose a section (eg initialisation) a table view to choose a subject (e.g. integer) then a text view of how to go about this.
When it was reviewed, they said
Did not include iOS features. For example, your app was just largely
text table views. It would be appropriate to use native iOS buttons
and iOS features other than just web views, Push Notifications, or
sharing.
I feel like adding these things would degrade from the simplicity and educational purpose of the app. Also, I feel it might be more difficult to navigate if its all iOS button based. Also it might be more difficult to add things later.
So how would you go about adding these things to a table based app so that it can pass the review? I just don't know what they want me to add/change. I have just added a title page with a background image and iOS buttons that direct to the main section a small section and the contact us page. What else can I do?
how would you go about adding these things to a table based app
I'd start by trying to forget about what I'd already done (since that was rejected) and ask myself: how can I design this using the tools available so that the user can quickly get to the information they need?
UIPickerView comes to mind. Instead of going through three screens just to say what you want, a picker with three sections would let you select all three parameters at once.
It'd be nice if you could provide access to the information in the app several ways. What if I want to browse through all the topics? Do I have to choose one section at a to,e, or can I just start reading? A search feature would be nice, so I can find stuff even when I don't know what section it's in. A tab bar and search field would be useful for these.
Perhaps the most important thing is that however it's designed, your app should look polished. It should look like you spent time making it useful and beautiful. Give it some personality.

Monotouch.Dialog Customizing cells

I wanna customize cells in MonoTouch.Dialog.
For example make custom background in BoolElement and make custom image for this small bool thing that can be on or off, sorry forgot the name, or make custom disclosure indicator image in StringElement.
Is there simple way to do this without making own custom elements?
In some cases you'll need to create custom Element-derived types to customize cells. In other cases you will be able to add some custom code inside your application. FWIW I think it's cleaner to create your own everytime.
You can find a lot of examples in the Sample application that is available on github along with MonoTouch.Dialog (that includes having a custom background and totally owner-drawn elements).
There are also several questions (with answers) about common MonoTouch.Dialog customizations here on stackoverflow. Click on the monotouch.dialog tag and read them.
If you get stuck on a particular customization then don't hesitate to ask for help.

Help with Application Settings

I'm developing the settings page for an iPhone application I'm working on. The basics are simple enough but there are some interesting things I've seen in the settings for some of the default iPhone and I was wondering if they are easy to create.
Two things in particular are having a UITextView as a child pane (an example of this is the signature in the Mail app settings) as well as having settings appear and disappear based on a switch (an example would be in the Wifi settings).
Any ideas if these are somewhat easily achievable?
EDIT: I'm aware I can achieve a similar effect by creating a custom settings page. What I want to know is if the things I mentioned are possible for application creators.
Use UITableView and build your custom subclasses of UITableViewCell class for various settings. You can easily manipulate a table view for making things appear and disappear dynamically.
As #Kakosquid suggested you can try a table view with custom cells. You can go through this tutorial for more info on custom cells

UIAlertView replacement

It seems that I am always fighting with UIAlertView to make it do what I want. I'm done fighting - are there any robust UIAlertView replacements with the following features, or will I need to write my own?:
ability to customize the alert-view size/position
ability to change the layout of the
buttons (stacked vs. side-by-side)
ability to prompt users for input via UITextField or UITextView
resizing / repositioning behavior
when the keyboard appears
ability to have a UITextView for
scrolling text
pixel-perfect copy of UIAlertView for
basic display
ideally interface compatible with
UIAlertView - i.e. it is a drop-in-replacement.
I've found a few blog and stackoverflow posts which implement customizations on a UIAlertView - this is NOT what I want. Nor do I want a guide on how to implement a custom AlertView -- I know how, I just want to find one that is already community maintained. I want a ground-up replacement that is safe for App Store submission and future-proof against UIAlertView changes (yes, I've been burnt...)
Please respond with comments if you have suggestions for other desirable features.
Answering my own question.
I searched high and low for a prefab UIAlertView project that offered the features I was looking for. I'm sure they exist -- I've seen apps with great alerts. Their authors must not be sharing - which is totally fine, I understand.
So I wrote my own. TSAlertView is a ground-up implementation of a modal alert view that is interface-compatible with UIAlertView. In terms of visual look, while it is not a pixel-perfect copy, it comes very close. The features it offers are basically what I outlined in the original question:
ability to set the display-width and max-height of the alert view. This allows me to have nicer looking alerts on iPad.
ability to specify the layout of the buttons (stacked vs. side-by-side), even if there are only two buttons. This always bothered me with UIAlertView -- if I had two buttons they were always placed side-by-side. A big problem if the button text didn't fit.
ability to prompt users for input via a UITextField. Once in a while you just need a quick and dirty way to prompt the user to enter something.
resizing / repositioning behavior when the keyboard appears. (happens when prompting for user-input)
ability to have a UITextView for scrolling text. Can explicitly set this option instead of relying on UIAlertView to swap in a UITextView for long text.
near pixel-perfect copy of UIAlertView for basic display.
support for custom backgrounds
is interface compatible with UIAlertView - i.e. it is a drop-in-replacement.
I've used a handful of great open-source projects in my code in the last year. My two favorites are MBProgressHUD and MGSplitViewController, each hosted at github. I decided to share TSAlertView in the same manner.
https://github.com/TomSwift/TSAlertView
The initial implementation surely has some bugs. I haven't used it in a shipping project yet, but I am using it in my current project to be completed in a few weeks. If you want to try using it yourself, please feel free. Post any issues on github, or better yet, submit a fix.
Enjoy!
Here are some screenshots showing 1) 2 stacked buttons 2) input capability 3) explicit width setting
Check out Smart Alert View, it's open-source.
Check my own Alert view replacement - get app here. https://github.com/FeminaErnest/GeekyFemi. Good luck

Is there a way to create custom UIDataDetectorTypes?

What I am trying to do is create tooltip functionality so that certain words in my instructional app can be tapped and the definition pops up. For the popup part I plan on using code from “AFInformationView” which provides bubbles on the iPhone.
The part I'm struggling with is how to associate A particular word's location with the bubble. Currently I have the text on a UILabel that is on a custom UITableCell. Since I calculate the row height on the fly with:
[textToUse sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:CGSizeMake(stop-start, 500)];
I'm not sure what the coordinates for a specific word will be. I was thinking that if I created a custom DataDetectorType that could be the fix.
If anyone knows how to do this or has any other ideas I would be happy to hear them.
Thanks,
Andrew
I didn't create a custom UIDataDetectorTypes but Craig Hockenberry did something like it with his TwitterrificTouch.
He uses regular expressions to detect links and other things. I provide it with my keywords and then they become tappable. He places buttons on top of the matching text from the underlying labels. You can google a lot of posts that talk about "putting transparent buttons on top" of various things but Craig's code is the only example/working code I could find.
Here is the link:
http://furbo.org/2008/10/07/fancy-uilabels/
I don't think this is possible. The (few) Data Detector types that the iPhone currently supports are hard-coded with a integer type id. There does not seem to be a mechanism to extends that list of types.
File a feature request in their bug tracker. I will do the same.
AFAIK, you can't create custom data detectors.
The best approach for this sort of thing seems to be using UIWebViews. At least that's what I did. However, you shouldn't use a UIWebView inside a UITableViewCell. In fact, no subview of a UITableViewCell should respond to user input. So I think the best approach would be to display a UIWebView when the cell is tapped.
UIWebViews could be a possible approach but on scrolling you should consider that the whole text should be parsed to detect the words.You could use HTMl tags to make them blue and provide the links.But how could i then assign a custom behavior then opening in safari?
If you want custom data detector you could write an extractor method to primarly patch the links with help of NSregularExpression. For example
NSString regex = #"(http|https|fb)://((\w)|([0-9]*)|([-|_]))+(\.|/)"; to patch alll the links including Facebook URLs inside text like fb://friends.
Then you could use NSattributedString yo mark the links with different colors etc.
ThreeTwenty has a great library called TTTAttributedLabel where you could assign links to certain parts of a text. I also scrolls quite fast if you use it in tableviews
https://github.com/mattt/TTTAttributedLabel