I need a customized keyboard. Only certain certain letters should be in the keyboard. I guess this is quite easy. The problem is that I need each tangent to basically contain 2 characters.
Lets say that each letter has a value. So for the letter A that has a value of 1 I also need to display that number in the same tangent. I would be like 70-80% of all the space would be taken by the letter A and (maybe at the bottom, right aligned) there would be a little number.
I guess this is not possible to do by using and customizing the default keyboard right? What would you suggest? Thanks.
considering you requirements you got nothing to do with the default keyboard...
create a UIView with buttons for the keys and use it wherever you like.
Godd Luck,
Related
I want to output a image when a user taps on the keyboard. Let's say the user taps A on the keyboard in a UITextView. Instead of outputting the normal A, I want to output the picture of an Ape.
If a user taps "S" I want to output the image of a sun. Is this possible with out having to make a customized keyboard?
Besides creating a custom keyboard yourself, there isn't really a neat method to getting an image output.
One thing you could do is program Swift to automatically recognise the letter input and display an image over or replacing the letter as a result.
To do this, assign a variable to your editable UITextView or UITextField. If you are using XCode you can do this by control-dragging the text field into your code and it will automatically create a weak var, but you can change the strength in the pop up box that appears.
Since you now have a variable, there are two options as to how you display the image. One way is rather boring and will clutter your code, but essentially involves this, which I have simplified for the purposes of demonstration:
if UITextInput == a {
// add image
}
You would have to repeat this for every letter of the alphabet.
Or you could create a dictionary in which each letter corresponds to each image, and find a way to cycle through them, depending on the user's input. Even though this is harder to program for a newbie, it makes the code much neater and quicker.
This is the link to the official Apple documentation on dictionaries:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-ID113
However, since I assume you are programming an app for the younger market, I would recommend creating a custom keyboard as it will be easier in the long run.
Hope this helps,
will
I have aUIViewController, which has inside a UIView in which I add a UIPageViewController with the UIViewController as the delegate. The thing is that the UIPageControl of the UIPageViewController is not working as I had expected regarding the dots selection.
I was expecting that if I selected the dot 4, it would take me to the dot 4, yet, It doesn't work like that. It always goes to the following page if I select the right half of the UIPageControl (inside the blue square of the image), and goes to the previous page if I select the left half of the UIPageControl (inside the red square of the image). So, If im in page 2 and select around the second dot, it goes to page 1 (instead of staying on page 2)
Moreover, If I click exactly inside one of the dots (any of the dots), the click is ignored, although im not sure how this works on device (since in the device is more difficult to click exactly inside one dot).
My questions:
1 - Is ignoring exactly inside the dots behavior normal (by exactly inside the dots, I mean not around them)?
2 - Is two halves selection of the UIPageController to move between pages behavior normal?
3 - How can I make it so that if I press the dot X, it takes me to page X (instead of the current two halves behavior)?
Note: I prefer swift
1 - Is ignoring exactly inside the dots behavior normal (by exactly inside the dots, I mean not around them)?
I've never encountered this. I would say its not normal. Something may be overriding it.
2 - Is two halves selection of the UIPageController to move between pages behavior normal?
Yes this is the default behavior for UIPageController.
3 - How can I make it so that if I press the dot X, it takes me to page X (instead of the current two halves behavior)?
I would recommend not doing this. The reason that it isn't this way by default is the touch space is too small (when using a finger not a mouse). So it makes sense to only go forward and back. You'd have to create a custom UIControl to be able to do this if you really need to for some reason.
I would suggest you to use external library for that, as this problem was more or less solved. It is quite complicated to do by subclassing native page control but you can probably find implementation somewhere.
This library does exactly what you want (jump to page) :
https://github.com/Spaceman-Labs/SMPageControl
In the documentation, look for section "Direct Page Selection"
Hope it helps!
Edit: Few more libraries to look into:
https://github.com/TanguyAladenise/TAPageControl
https://github.com/nicklockwood/FXPageControl (very extensive, probably too much)
I'm developing an app that calculates poker odds, and now I'm facing some problems with the card selector.
This is a mockup of what I want.
I've found two ways to accomplish this. The first one is to use an entire UIImageView and detect touches, calculate where the touch has been generated, and set the corresponding value.
The second one is to use a lot of UIButtons, but in this case I get problems with the shape of the buttons.
Of course I can use a regular UIPickerView and so on but I think that the one I've designed is better.
if you have a UIButton with a background image that is shaped irregular. then that is the only point that the button can be pressed.
Change the type to custom and put your slices into buttons.
This has been my experience anyhow.
My buttons have to have a .01 alpha background to increase their pad size and people can push the button.
Hope that helps :)
After googled a little i've found https://github.com/ole/OBShapedButton .
it does anything what i need
I have to create custom keyboard like the real keyboard in iOS.
I need to do following like keyboard.
like that.
How can i create like that?
Please tell me , because i'm just new beginner.
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
With a custom view and custom buttons. The keyboard itself is something very easy to do, you just need to place some buttons on a view and then show that view.
Your real problem will be connecting the button actions to the text field.
You would have to check for the first responder and then add to its text the value corresponding to your custom keyboard. It will be an even more difficult problem to actually "type" those weird characters from the keyboard in the text field. I am not familiar with them, are those real ASCII characters?
Anyway, you're in for quite some work. It's not something very difficult to code, requiring some complicate algorithms, but the implementation will be tricky and complex, so be careful
I need to show a registered trademark symbol in a superscript (exponent position) in respect to the name of the label. need to show it in a uipickerView and a label. I havent found the option of how to show the unicode \u00AE in the exponent position,
1) Should I use 2 labels in different positions in the uipickerView?
2) Or, Show an image in the picker view with the intended name?
Thanks a lot!
For me this works:
#"Sometext \u00AE other text".
Can you check?
The unicode symbol is very slightly superscripted but I guess this isn't enough for you. You can't mix font sizes and styles within a label so there isn't an easy answer. Two labels probably won't work because you will be having to adjust the position of the R sign.
The simplest answer is probably to subclass UILabel and, in the drawRect method, call the super implementation and then manually draw the R string where you want it. You can get the size of the existing text using the NSString drawing methods so you'll know where to put the symbol.
I ended up using an image in the picker view to show the superscript as needed,
inspired by the catalog app from apple,
if you are a noob like me and would like to check the project, please go to
project in Github