1. You can set the background color for this control when you encounter a problem that the UI control does not display
Suppose this control is UIButton
If the background color can be displayed, the problem is that the image and title value are empty
If the background color cannot be displayed, override the control's description method and print the control frame to analyze
2. The following is the classification of frame for printing UIView
#import <UIKit/UIKit.h>@interface UIView (Log)@end
1 #import "uiview+log.h"2 3 @implementationUIView (Log)4 5+ (NSString *) Searchallsubviews: (UIView *) Superview6 {7nsmutablestring *xml = [nsmutablestringstring];8 9NSString *class= Nsstringfromclass (Superview.class);Ten //the class name of some controls is underlined _,xml contains an underscore _ error One class= [classStringbyreplacingoccurrencesofstring:@"_"Withstring:@""]; A - if([classIsequaltostring:@"Uiscrollview"]) { -Uiscrollview *realview= (Uiscrollview *) Superview; the[XML AppendFormat:@"<%@ frame=\"%@\"contentsize=\ "%@\" >\n",class, Nsstringfromcgrect (Superview.frame), Nsstringfromcgsize (realview.contentsize)]; -}Else{ -[XML AppendFormat:@"<%@ frame=\"%@\">\n",class, Nsstringfromcgrect (Superview.frame)]; - } + - for(UIView *childviewinchsuperview.subviews) { +NSString *subviewxml =[self searchallsubviews:childview]; A [XML appendstring:subviewxml]; at } -[XML AppendFormat:@"</%@>\n",class]; - returnXML; - - } - in-(NSString *) Description - { to return[UIView searchallsubviews:self]; + } - the @end
3. Using the above classification, it is easy to print the UI control, the printed information stuck in the XML file, open with Firefox, easy to browse
Debugging Tips for IOS UI controls when they are not displayed