I have a UIViewController with a lot of UIButtons (each with a custom UIImage), and when I push that UIViewController to the UINavigationController, it does not show a smooth animation.
So basically same problem as here: Low frame rate during UINavigationController push transition
But I don't want to hide my UIButtons during the animation, I want something like what they do in this game
which is not "laggy".
How can I do that?
Thank you.
If you want to achieve the view which is similar to the one in the itunes link which you have provided then I dont see the use of lot of UIButtons. As adding too many UIButtons will make the view heavy.
Replace UIButtons with CALayer, as CALayer is light weight compare to UIButtons.
You can make use of 'name' property of CALayer to give unique name to each layer and override the hitTest method to get the layer which you tap and achieve the same functionality as UIButton.
Related
I've tried this with custom listview but it gives me a lot of problem because I already have scollview. (as in the pic, listview inside scrollview)
I'm wondering if I could make a LinearLayout with imageview, textview for the name, and textview for the comments inside it and loop it so it will show all the comments like in the picture.
Yes you can add what you want to a LinearLayout.
For performance reason this is not a good approach, because by this way you don't take advantage of views reclyclement. That means that if you add many much son views to your LinearLayout they are always loaded into memory and you should saturate it on poor devices.
You should migrate to the RecyclerView or in alternative you could keep your ScrollView and your ListView and read this answer
in ios6 I had UITextfield placed on UIAlertview to take inputs from user.
but in ios7 it don't seem to be working.
Any idea how to achieve that in ios7?
Thanks,
Virat
For the same task I'm creating UIView subclasses that I add as subviews to the main window. This way they will appear on top of everything and I'm in control of the layout & functionality.
I spent so much time implementing a collection view and subclassed UICollectionViewLayout only to find a bug in iOS 6 which makes cells disappear while scrolling if the cell is very large in size.
Large UICollectionViewCell's disappearing with custom layout
I am unable to find a solution so far, but I realize I may be able to do with just a UIScrollView instead of a UICollectionView and do not need cell reuse. Is there an obvious way to convert existing UICollectionView to a normal UIScrollView ? Of course, I can write my own UIScrollView subclass from scratch but that would mean a lot of work again.
I solved my problem using an alternative implementation of UICollectionView called PSTCollectionView :
https://github.com/steipete/PSTCollectionView
I have a view with a lot of labels and buttons which are created on code because in IB is too complicated. This works ok.
In IB I also created an input view which I want to appear from the bottom by the tap on a button. Very much like a keyboard if you will. Because this input view is strigth forward, it has been created on IB and it contains sliders, labels, etc. I haven't added it as a subview of self.view on IB.
By the tap of the button, I set up all the constrains for the input view: I set the width, I set it on the bottom of the self.view with vertical size, then I remove this constraint, I add the actual heigth and then I animate with [self.view layoutIfNeeded].
The thing is that the input view itsef animates correctly, but its subviews not so much. They kind of appear at once.
I have tried adding a input view programmatically, with only one switch. It animates quite nicely.
I'm guessing that there is a problem with the constrains between the controls and their superView. But I'm not sure about it, because although they do not animate correctly, they are on the correct place and witht the correct proportions. I guess I'm missing something here. Maybe it's not a good idea to mix IB set controls and views and programmatically modifying them?
Does somebody have any experience with that?
Thanks in advance,
I suggest you post to Apple's dev boards on this subject. I've seen several posts there recently. The Apple Engineers who replied said that with Autolayout, you basically give autolayout ownership of your view's center, size, and sometimes, transform.
To animate views that use autolayout, you should apparently use UIView block animation and animate the constraint settings on the views. The system will then animate the changes you make.
Not sure about adding new views programmatically and having them animate into place however.
I have a model that looks good with lighting, but in that model I want to add a 3D-surface-graph that looks best if I turn lighting off. Does anyone know if it is possible to make the light affect only a selection of objects in my scene?
The best I have come up with so far is to combine a DiffuseMaterial and an EmissiveMaterial with the same color, but that results in some strange visual effects so it’s far from perfect.
If there are no lights you will not see the object.
If you want to have a different set of lights for a specific object just put the object in a separate Model3DGroup with its own lights.