UIPickerView touch issue in iOS 7 - ios7

I have an issue with UIPickerView specifically in iOS 7.  I have a picker view with 5 columns. For some columns, when the user touches any item, the PickerView doesn't scrolls to that item. The same issue is found in UIDatePickerView too. Any help is appreciated.

This blog post will shed some light on the changes to the pickerViews.
http://blog.ittybittyapps.com/blog/2013/09/20/lifting-the-lid-on-ios-7s-uipicker/
The changes to the picker architecture were significant and if you need to try to fix it, you might have to build your own picker views.
There are a number of projects on github you could use to roll your own, such as AFPickerView, https://github.com/arkichek/AFPickerView (but clearly that's not the iOS7 kind of picker)

Related

How to display UIAlertView without buttons on iOS 8?

In an app I'm working on we have some legacy code that displays timed UIAlertViews at several points in the application. These are alert views that display for a certain amount of time (let's say 2 seconds) before they disappear.
These alert views don't have buttons, just a title and a message. Somehow these alert views worked just fine on iOS 5, 6 and 7, but on iOS 8 the message label isn't being displayed anymore.
Does anyone have a fix for this issue? I should note we're not interested in using UIAlertController, since that class is limited to iOS 8 and we need to support older versions as well.
So my question is as follows: is it possible on iOS 8 to display an UIAlertView with just a title and a message and NO buttons? (PLEASE NOTE: the message should be shown properly).
For anyone still struggling with this issue, I used the following approach:
I created an AlertController class that decided which version of an alert view to use. For iOS 7 and lower will default to the "build-in" UIAlertView. For iOS 8 I resorted to a custom alert view.
There are several custom alert views that could be used to create a modal dialog that displays for a few seconds. I based my custom alert view on the code from the iOS Custom Alert View project. Additionally I fixed the look and feel. Suffice to say, the default look and feel of this project doesn't closely match the iOS 7 / 8 look and feel, especially with regards to the buttons. The pop / hide animation is pretty well done though. Fixing the look and feel involved creating a custom dialog view class that uses -drawRect: to draw lines around buttons. The custom subview will also add it's own buttons.
An alternative project that might have a better look and feel out-of-the-box is SDCAlertView. If I would have found SDCAlertView before starting my work on fixing iOS Custom AlertView, I would probably have saved some time.
I should note I cannot share my code / changes. My employer would not like this at all.
You can try this code for your UIAlert:
let alert = UIAlertView()
alert.title = "Title"
alert.message = "Message"
alert.show()
It should display a UIAlert without a button.
Hope this can help you.

What would be the quickest way to create a long form on iOS/iPhone

I'm fairly new to the world of Objective-C and iOS development (this is my first iphone app), and i have a background in c#/java dev.
My employer wants an iphone app for one of our sites. In it, there's supposed to be a form that has about 50 fields in it and can be broken up into 3 different sections if needed.
What would be the best way to go about handling this?
Thanks!
I would make a UITextField for each of the fields.
Then I would add those as subviews of 3 UIViews that will represent the 3 sections you mentioned (breaking up the UITextFields into each view as necessary).
Then I would create a UIScrollView and add each of these UIViews as subviews (stacking them by position; ie bottom of first is touching top of second) .
This will allow you to scroll through the UIViews if the page is too long (50 fields will most likely not fit on an iPhone screen).
For more info:
UIView - https://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html
UIScrollView - https://developer.apple.com/library/ios/documentation/uikit/reference/uiscrollview_class/Reference/UIScrollView.html
UITextField - https://developer.apple.com/library/ios/documentation/uikit/reference/UITextField_Class/Reference/UITextField.html
There are some tutorials out there for this. Basically, I would create all appropriate fields or form criteria, and embed them in a srollview. You select all the fields and click editor>embed in>scrollview.
You then need to setup the field to scroll into view when it is clicked. This can be found in tutorials.
You then need to setup a function to dismiss the keyboard if a user clicks off the field. Again this can be found on tutorials.
If you need anymore help please comment. My background is java too and have just started learning Obj-c and swift.

LeftBarButtonItem not working on iOS7

I am using this API in my application. The sample app given is working fine for both iOS7 and 6. After integrating it into my app Tap Gesture is not working on UILeftBarButtonItem in iOS 7, but working in iOS 6. Please see the screen shot below:
Both UIRightBarButtonItems are working fine and their action is getting executed but the left button is not working in iOS7
I have wasted several hours but couldn't figure out why it is not working only in iOS7. I found this thread on SO but no luck.
Any help would be greatly appreciated.
It's time to answer my question
The problem was that I was disabling the refresh button on top right corner of the Navigation Bar on start of the method it triggers and reenabling it later on the basis of subview index but some strange reason it was disabling my leftbar button but in iOs6 it was disabling the Refresh button. There is some problem with the Subview indexing in iOS7.0
I am late to answer but you made a serious mistake relying on subview index.
My approach for such a case would be
Make an IBOutlet of UIButton and add it to navigation bar.
When it comes to enable to disable I would use the outlet of button.
Hope that would help anybody else facing this problem.

Make multiple NSScrollViews scroll at the same time

I am developing a Cocoa Application for Mac OSX. I intend to have multiple NSScrollViews and I'd like all of them to scroll at the same time if one of them is selected and scrolled.
I saw for UIScrollView there is a method "scrollViewDidScroll" that I could do this with an iPhone application.
Is there anything similar for NSScrollView or a way to go about doing this? Any help would be greatly appreciated.
Your solution is going to require that one of the scroll views will need to receive notifications that the other scroll view is being scrolled.
Apple actually provides some very nice documentation on Synchronizing Scroll Views, which also has some sample code snippets as part of it.

How to position static buttons and iPhone 5

I am working on an app where i have 12 buttons and labels underneath on one of the views. They are placed on the storyboard directly. I want to make sure they will get properly repositioned in iPhone 5. The solution that i tried is just to deselect all the lines in the autosizing for all the buttons. Now when i try it on iphone 5 the buttons get resized. The problem if i stretch the storyboard and move the buttons they get messed up when running on the smaller screen. So i can only position them on the smaller screen and then it seems to work. The app does not rotate. I would like to know if this is a good solution or there is a better solution for this case. I would like for the app to support iOS 5+
Thank you!
If you want layouts to work with varying screen sizes, you should become familiar with the new constraint-based layout scheme in iOS 6. A WWDC video on the subject can be viewed at http://www.youtube.com/watch?v=Dkr9eKxlMAk&feature=player_detailpage.
Essentially, you're going to use the old struts and springs system for pre-iOS 5 and conditionally use the new scheme for iOS 6. (iPhone 5 won't run any iOS version prior to 6.)