Go to https://github.com/glock45/iOS-Hierarchy-Viewer
Download and add it to your project.
When the layout issue shows up in iOS simulator, open a web browser and go to the iOS Hierarchy Viewer page (shown in app debug output at program launch.)
Starting from UIWindow, check frame of the UIViews until the problematic UIView.
Monday, 24 June 2013
Friday, 14 June 2013
CMake Configuration Failure due to Python
CMake configuration may fail due to python version issue. Sometimes a project requires an old version of python but CMake uses the newer version of python, which causes the failure. On Windows with GUI version of CMake, this can be resolved by choose the advanced option and modify the used python path to be an old version of python.
Saturday, 8 June 2013
UIKit: Stop Touches in a Subview being Handled by its Superview
If view A has a gesture recognizer, and this view has a subview B which does not have gesture recognizer, the gesture happened in the subview B will be recognized by the gesture recognizer of view A.
This may not be what you want. For example, if subview B is showing an introduction, you do not want a tap in it to be handled by view A.
One solution is to make view A a delegate of its gesture recognizer, and define a method:
-(BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldReceiveTouch:(UITouch *)touch {
return touch.view == self;
}
In this way, the gesture recognizer will not recognize gestures happen in its subview.
Wednesday, 5 June 2013
How to move files to another directory in Xcode 4
Move files physically to the desired directory, then open the project in Xcode 4, select the group, in the right "Identity and Type" panel, click the strange looking icon beside "Path" item, and choose the new directory of your files.
P.S. If your files are under version control, you cannot simply move files with Finder or mv command. You need to move them through version control system, otherwise you are in big trouble.
P.S. If your files are under version control, you cannot simply move files with Finder or mv command. You need to move them through version control system, otherwise you are in big trouble.
Sunday, 2 June 2013
iOS: How to find your artist id in app store
Go to http://itunes.apple.com/linkmaker and search for your name, you will find your artist id and all your app ids.
UIKit: programmatically created subview or control has wrong location
If you programmatically create subview or control, you better do it in viewDidAppear. Only at that time your view's size is finalized. Before that, if you use your view's size to determine the location of your subview or control, it may be wrong since your view may be resized.
Another solution is to use setAutoresizingMask, e.g., if your button is at the bottom of the screen, you need setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin. If the view height changes, your button goes with it.
Another solution is to use setAutoresizingMask, e.g., if your button is at the bottom of the screen, you need setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin. If the view height changes, your button goes with it.
iOS: share methods between classes
Two classes can shared methods through category. For example, you have two subclasses of UIViewController. You want to add some common methods to both, then you can create a UIViewController category which contains these common methods.
Subscribe to:
Posts (Atom)