I am making an app through which the user dials the number.I want to design my own number pad with delete button.I can make them easily by taking 10 buttons on the UIView and placing them accordingly and whenever the button presses i will have the button number updated in my dialer box.
I want to know whether my approach is good or there is something else through which i can achieve this in a better manner.
You can do this by using following 3 ways,
As comment given by #nerowolfe i.e. by using keyboardType equals to UIKeyboardTypePhonePad...
You can get many keyboard type click here
Using UIView with array of buttons inside it as you think.
If you are building this app for ipad then you should use popover instead of UIView or any custom vies. Using popover is more standard way than custom view for ipad. It gives benefits like,
Requires small space
Good look
Standard way
My suggestion to u is that if you are building app for iphone then option 1 or 2 is better and if you are building it for ipad option 3 is great...
Related
I want to open dialer on click of label consisting of mobile number in swift 3 iOS.Please help me with this.
You can't make links clickable in a label unless you do it yourself with a gesture recognizer.
I suggest using a UITextView instead. You can turn off editing and make it look just like a label, then enable phone number detectors, set yourself up as the delegate of the text view, and dial the number when the user taps it. Take a look at the textView(_:shouldInteractWith:in:interaction:) UITextViewDelegate method. You should be able to find example code showing how to do it.
EDIT:
I have a project on Github called DatesInSwift that uses clickable text fields as I've described, although it uses a custom URL scheme that links back to the app rather than dialing a phone number like you want. The idea is very similar, though, and you should be able to use the sample app as a guide.
We are developing an iOS app using Swift.
We have a tableView where each TableCell is expandable.
It currently looks like this. (Ignore the abbreviation of the time label, this is not intended)
When executed on a tablet the labels from the expanded sub cell should be moved to the parent cell, depending on how much space is available.
It would not be a problem if we have to make a separate scene for tablets and phones.
It would be beautiful, if we could change the display of those scenes directly in the interface builder, depending on which device is selected on the bottom bar.
What is the best (cleanest) way to achieve that?
Thanks in advance.
What you need sounds like the "vary for traits" option in Xcode 8, it allows you to have different configurations of the same view depending on the device(actually based on Width and Height settings) but it narrow down to device as you use it, if you click the vary for traits button in Xcode you will see the various options for W and H and you can see in real time how the devices changes depending on your selection. Just be a little bit careful about one thing, when you introduce a new setting you use the vary for traits button but after that you access it from the right hand side picker as normal.
You will see in Xcode 8 that some attributes have a small + sign next to them, that is where you will find your different traits after you have introduced them, it takes some getting used to but is very powerful once you get your head around it. It is also the recommended way to make adaptive applications in iOS
I am making an app where I use the "People" emojis as avatar faces and the "Food and drink" emojis for, well, food and drink icons. I would like to use the regular keyboard for presenting the emojis for user input, but I would like to present only these two categories of emojis (and even so, each category would be presented in a different context).
I am working with iOS 8, Xcode 6.3 and Swift.
Can I configure the regular keyboard so that it only shows a subset of emojis which I define?
If not, can I create a new custom keyboard preserving everything from the original Apple keyboard but limiting the subset of characters? Any pointers on how to do this?
Thanks.
You can not configure the regular keyboard so that it only shows a subset of emojis. But yes can make your own custom keyboard.
You can find some really good posts about how to make the custom keyboards:
http://verisage.us/en/blog/2014/07/17/ios-8-custom-keyboard-swift-tutorial/
http://code.tutsplus.com/tutorials/ios-8-creating-a-custom-keyboard-in-swift--cms-22344
Also I found this FaceBoardPlus sample: http://code4app.net/ios/FaceBoardPlus/52a9ba56cb7e841e178b69d0 which is exactly what you are looking for but written in objective c.
EDIT: From iOS developer library:
After a user chooses a custom keyboard, it becomes the keyboard for
every app the user opens. For this reason, a keyboard you create must,
at minimum, provide certain base features. Most important, your
keyboard must allow the user to switch to another keyboard.
To provide a fully custom keyboard for just your app or to supplement
the system keyboard with custom keys in just your app, the iOS SDK
provides other, better options. Read about custom input views and
input accessory views in Custom Views for Data Input in Text
Programming Guide for iOS.
Generally I look at Apple's UICatalog sample code for basic VoiceOver support however it looks like there is VoiceOver support for UIPickerViews in the sample code. Do I need to provide an accessibilityLabel method somewhere to add VoiceOver support? I tried to implement UIPickerViewAccessibilityDelegate methods but voice over only reads the labels in my picker view and not the hint to swipe up or down to change the values.
Also my picker view is set to the input view of a UITextField. So I'm not sure if that is relevant or not.
Update:
https://github.com/stevemoser/VoiceOverPicker
I created a sample project demonstrating the issue. In the example there is a normal picker view shown and a textfield. There is also a picker that is set to the textfield's input view property. I can't seem to activate the either picker just by tapping on it while using VoiceOver. Though I can activate either one by swiping (left and right) through the views on screen. Any ideas?
Update 2:
Looks like if the app is an iPhone app running on an iPhone or an iPad app running on an iPad it works fine but if it is an iPhone only app running on an iPad, tapping to select a UIPickerView doesn't work.
Are you just doing a vanilla UIPickerView using titles for each row (and not custom views)? If so, there isn't anything that you should have to do.
You mentioned that VoiceOver was correctly reading the label on each row, so we know that the UIPickerView correctly has isAccessibilityElement set to YES. It's also correctly reading the accessibilityLabels.
Is it possible that you're interacting with the picker before it has a chance to read the accessibilityHint? (For the benefit of others, the accessibilityHint is the "swipe or down with one finger to adjust the value" that Steve mentioned in his question.) Or perhaps some notification is changing the VoiceOver focus before the hint has a chance to be read?
By default, if your picker view is accessible, when you focus on it with VoiceOver it will read the something along these lines:
"[ROW LABEL] Adjustable [#number] out of [#total] picker item" a 2 to
3 second pause then "Swipe up or down to select value"
A few of things to note:
There is a 2 to 3 second delay between reading the label and the hint, make sure you wait for it.
If you're providing your own hint, the default one will not get read I believe
Hints are only read when you reach a certain control by either directly pressing it or by swiping right or left to the control. it will not get read if you do a 2 finger swipe down or up.
Make sure you're testing on an actual device and not a simulator as it does not show all of the things VoiceOver announces.
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.