I have an iPhone app that works fine in 2.x version of the SDK. When I upgraded to 3.0, the didSelectRowAtIndexPath method is no longer called, so the action when a user highlights a row doesn't happen. This is a custom UITableViewCell that is in a separate nib from the UITableView. Both the data source and data delegate are properly wired up in Interface Builder, and if I compile it to 2.21, it works. On version 3.0, clicking on the row doesn't do anything.
This question, mentions a similar issue, but they mention another first responder that is taking the click. I don't have any first responder methods hooked up to the cell or table.
How can I have the table work properly in 2.x and 3.0? The custom cell has a few labels and an image, and I just want to be able to click on a row and show the details for that particular row.
You probably won't like this answer too much...
Some things that worked in 2.2, don't work in 3.0 (you already know this). Some APIs have changed, etc…
A few things, however, are different because they were never supposed to work in the first place (according to Apple).
I can't be sure one of these changes is your issue, but it might be. Subtleties having to do with nibs and properties were definitely affected.
My advice would be:
First, check your nib connections, Maybe you have a connection missing that 2.2 let you get away with, but 3.0 will not.
Next, build a test app with a simple table view and see if you can get it to work. If it does, you should begin adding in complexities from your code into the test app until it breaks.
Unfortunately, this may take some time. You can also post some code to see if there is anything that we can find.
I had this same problem. I spent hours on it trying just about anything you can imagine. The funny thing was it ended up not being a problem with my code.
I am using Objective Resource and after upgrading to version 1.0.1 the problem went away. Check all your third party libraries and make sure that you are using the latest to ensure you have their 3.0 changes.
Related
I have searched multiple discussions/examples for hours re UITableView using UIRefreshControl, and found most predate iOS11, and fall into one of two basic implementations, neither of which are working for me. Either I pull down and it won't finish (i.e., control slides with spinning wheel, and swiping up merely bounces it back down - yes, I'm using .endRefreshing); or it successfully completes but not before flashing large title on top of control (with original title still pulled down), and table cells jump up and down.
I am using Storyboard, and checking the enable box. I am placing the code in ViewDidLoad, and have tried declaring a custom var outside and inside ViewDidLoad (as well as not using one, but that seems incorrect). In ViewDidLoad, I have tried using tableView's .refreshControl, as well as .addSubview. In the selector func, I have tried placing .reloadData above and below .endRefreshing. Every variation produces one of the above two incorrect behaviors.
I am new to all of this, and completely frustrated, as all I'm trying to do is learn how to implement the feature on an iPhone. I saw a post stating UIRefreshControl does not work as of earlier this month, but I find it hard to believe that Apple would just leave this rudimentary and ubiquitous feature broken for weeks+. Can anyone please help? Thanks, and happy holidays!
I just learned about UICollectionView after creating the same functionality in a custom class. So I am thinking about using deleting all that code I wrote and just using UICollectionView.
I know my app gets a lot of installs on iOS 5. And I know a lot non tech savvy friends and family still have it installed.
I googled this and it says I can use some other's guys library(another thing I should have known before writing my custom class). But the answer was not definitive.
So my question is, does Apple include a bridge for iOS 5 or will my app just fail if I use UICollectionView?
I have my target deployment set to 5.0 and it is not giving me any warnings.
Venkat
UICollectionView is iOS6 only. You can include extra code to check for iOS6 and use your custom class on iOS5. But there is no way to use an actual UICollectionView in iOS5.'
Thats what that "other guy's library" does. It has an iOS5 compliant clone of UICollectionView and checks based on the OS which to use.
Maybe you want to try this as an alternative:
https://github.com/steipete/PSTCollectionView
Consider the above's IB objects listing. Siblings further down the list should be on top of the siblings listed further up when rendered on the screen.
Under Xcode 4.5.2, everything is ok if iphone simulator 5.1 is used. But for simulator 6.0 the map just covers everything. The same if using actual devices (phones) for testing.
Hope that somebody knowledgeable could help.
Please also add comments if you do not (or do) find such a problem on simulator 6.0. Chances are the problem is related to how my project is setup.
Update :
Have setup a new test project with iOS 6 map view myself. There seems to be no problem with z-order at all. So the problem could relate to my code. Unfortunately, quite a lot have already been written, there wouldn't be enough time to go over everything for the time being. I suspect that it has something to do with the rootViewController property. My project initially followed a older scheme in which rootViewController was not used ...
I dont know if that order is reliable at all -- in the past definitly not and I am not conviced it is today :D. (even though apple claims it :D)
see: IPhone Interface Builder: Z-Index, Z-order of a button, image, ui element, etc?
(the 3rd answer currently. 7 votes)
The problem is solved by calling Window's bringSubviewToFront method. But I believe a better and more proper solution can be found given enough time.
I'm going to implement a view similar to the original photo app in iOS.
I created a customized UITableViewCell which has 4 UIButton in it. And it updates the button's image when the image array of the cell changed.
I worked hard to get the performance really satisfying. However, I found a tricky lag problem about it.
When I use my app normally, the scrolling is very smooth without significant lag. But if I keep the app (simulator) running on the "thumbnail grid view", and switch to other applications in Mac OS. After a while (maybe about 1 minute), when I switch back to the simulator, the scroll view gets stuck. It's hard to scroll it. If I click on something switching to another view and then switch back, everything is smooth again. So tricky.
I also tried the TTRemoteExamples which uses three20 to implement the grid view. It also gets stuck after switching between different applications in Mac OS (not in the iOS).
Then I tried not filling the customized cell with UIButton but 4 images. It didn't get stuck. So maybe the reason lies in the conflict between UITableViewCell and UIButton?
I don't know if it only happens on simulator or have potential performance problem when shipped to device (I haven't got the device to test on).
Apple's photo app will never be like this.
So I'm going to implement it from UIScrollView by myself to see if the problem is caused by the UITableView's mechanism. I still want to know the reason for the lag if anyone has come to it and solved it.
Sorry for my poor English, I hope you can catch my meaning.
Who cares what the simulator does, seriously. Let it fart magical evil fairies that hijack the world's financial system causing it to enter a world of collapse...oh wait, maybe it already did that.
Seriously though, look at using code like AQGridView. It's very stable, provides an interface very much like a tableview, and is used in many projects. You also avoid the nonsense that is Three20 going this route. It's win-win.
But remember, always, and I do mean always, care what your app does on a device, if it isn't doing the same thing on the simulator, don't worry about it, you shouldn't be testing on the sim 99% of the time anyway. Users interact with your app on their devices, not your simulator. :)
Referring to Subclassing UITableViewCell section in Table View Programming Guide for iOS,
I finally solved the problem by implementing my custom mimicking the way from the guide, without adding subviews to UITableViewCell.
Apparently, adding too many subviews, only 4 in my code although, caused the strange problem I mentioned above. So, NEVER ADD SUBVIEWS, especially those with UIImageView's in it, to the contentView of UITableViewCell or UITableViewCell itself.
Instead, keep data's in the customized UITableViewCell, and do every drawing related thing in drawRect, using -[UIImage drawAtPoint:] and -[NSString drawAtPoint:withFont:].
In fact, the Apple's guide has mentioned it. It's careless of me skimming the part.
However, I'm still curious about why, as I mentioned, it only occurs when you switch between applications in your Mac OS, not iOS. I don't know the reason indeed.
In my project I have a subclass A of a UIPickerView.
In Interface Builder I have a UIPickerView whose type I have changed to my subclass A.
In another class B, also defined in my code, instantiated in Interface Builder and linked to A via its outlet, it refers to A with an IBOutlet field A *mySubclass.
The problem is this:
When running on the simulator it works fine; A breakpoint on B’s awakeFromNib confirms that mySubclass has been loaded and is indeed of type A.
When running on the device (iOS4.1 on iPhone 4) however, the same breakpoint reveals that mySubclass is now of type UIPickerView.
Adding an awakeFromNib to subclass A confirms that when running on the simulator A’s awakeFromNib gets called but not when running on the device.
Has anyone any idea why this might be?
Thanks in advance for any help,
Teo
An update:
After a couple of days of trying everything I eventually started trying some example projects on the device (which worked) and finally created a new project with the intention of migrating the code across in case the project itself had somehow gotten broken.
Having named the new project the same as the problematic one I noticed I couldn’t run it because of an UDID mismatch.
This caused me to have a look at the apps on the device through the Xcode organizer and noticed I had two of the same app on there. Deleting those made everything work again. Sigh. Glad it's sorted but if anyone has any idea exactly what happened I'd love to hear it.
Thanks for the eyeballs and sorry for asking an impossible problem although anyone reading this might now try removing the offending app from their device sooner rather than later.
Best, Teo