Debugging Tips for IOS UI controls when they are not displayed

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.