iOS Development Basics-Fragmentation 8

Source: Internet
Author: User

1: Use Uiimageview as the background, but direct the button or

The Uitextfield cannot be placed above the corresponding event.

Workaround: Uiimageview default userinteractionenabled is no, modify it to Yes, or you can directly have a property on the view above Xcode tick the user Interaction enabled scene ( Put a picture view in the scrolling view, put a button on the picture view, and find that there is no response effect.

2:afnetworking newspaper "Request failed:unacceptable content-type:text/html"

corresponding to their own projects, I use afnetworking this set of network request package, need to change is: AFURLRESPONSESERIALIZATION.M file 223 line: Self.acceptablecontenttypes = [ nssetsetwithobjects:@ "Application/json", @ "text/html", @ "Text/json", @ "Text/javascript", nil]; plus @ "text/html", part, is actually adding a data format that the server returns.

Conversion of 3:nsmutablearray and Nsarray to each other

Nsarray--Nsmutablearray  nsmutablearray *mymutablearray = [MyArray mutablecopy];  Nsmutablearray--Nsarray  nsarray *myarray = [Mymutablearray copy];  

4: Customize the Back button above the system navigation bar, as well as the text, right favorite button

 Middle title UILabel *navlabel = [[UILabel alloc] Initwithframe:cgrectmake (0, 0, 320, 44)];   Navlabel.text = @ "group purchase Details";   Navlabel.textcolor = [Uicolor Whitecolor];   Navlabel.font = [Uifont systemfontofsize:18];   Navlabel.textalignment = Nstextalignmentcenter;       Self.navigationItem.titleView = Navlabel;   Right collection button UIButton *rightbutton = [UIButton buttonwithtype:uibuttontypecustom];   Rightbutton.frame = CGRectMake (0, 0, 20, 20);   [Rightbutton Setbackgroundimage:load_image (@ "Meishoucang") forstate:uicontrolstatenormal];   [Rightbutton addtarget:self Action: @selector (Doshoucang) forcontrolevents:uicontroleventtouchupinside];   Uibarbuttonitem *rightitem = [[Uibarbuttonitem alloc] Initwithcustomview:rightbutton];       Self.navigationItem.rightBarButtonItem = Rightitem;   Left return button UIButton *fanhuibutton = [UIButton buttonwithtype:uibuttontypecustom];   Fanhuibutton.frame = CGRectMake (0, 0, 30, 40); [Fanhuibutton Setbackgroundimage:load_image (@ "Fanhuijiantou") forstate:uicontrolsTatenormal];   [Fanhuibutton addtarget:self Action: @selector (Dofanhui) forcontrolevents:uicontroleventtouchupinside];   Uibarbuttonitem *leftitem = [[Uibarbuttonitem alloc] Initwithcustomview:fanhuibutton]; Self.navigationItem.leftBarButtonItem = Leftitem; the title font on the navigation bar, the font size can be defined so that full use of the system's [ Self.navigationController.navigationBar settitletextattributes:[nsdictionary Dictionarywithobjectsandkeys: [ Uicolor colorwithred:1.0/255 green:1.0/255 blue:1.0/255 alpha:1], Uitextattributetextcolor,[uicolor ClearColor], Uitextattributetextshadowcolor,[uifont Systemfontofsize:20],uitextattributefont,nil]];

5: Clean the bottom empty column of UITableView

Self.tableView.tableFooterView = [[UIView alloc] init];

6: How to hide the right mouse button after navigation jump

Hide the return self.navigationitem.hidesbackbutton=yes;//to the left of the head Hide head right self.navigationitem.rightbarbuttonitem.customview.hidden=yes;

7: If you want to set the background map for the Uicollectionviewcontroller view

UIImage *image=[uiimage imagenamed:@ "APPBG"];self.collectionview.layer.contents= (ID) image. Cgimage;

8: Can be modified in other places Rootviewcontroller

UIWindow *window = [UIApplication Sharedapplication].keywindow;    Window.rootviewcontroller = [[Hvwtabbarviewcontroller alloc] init];

9: Sina Weibo authorized login warning:attempt to present on whose

View isn't in the window hierarchy!

Introductoryviewcontroller *introductory=[mainstoryboard instantiateviewcontrollerwithidentifier:@ " Introductoryview "];        Uinavigationcontroller *rootnavigationcontroller=[[uinavigationcontroller Alloc] Initwithrootviewcontroller: Introductory];            Self.window.rootviewcontroller=rootnavigationcontroller; The main problem is a jump to B, then B put a button to authorize Sina Weibo, add a uinavigationcontroller, Then in a jump to B with nav jump:    uistoryboard *mainstoryboard=[uistoryboard storyboardwithname:@ "Main" bundle:nil];    loginviewcontroller* Loginviewcontroll=[mainstoryboard instantiateviewcontrollerwithidentifier:@ " Loginviewcontroller "];    [Self.navigationcontroller pushviewcontroller:loginviewcontroll  Animated:yes];

10: In the introduction of the third party TCWEIBOSDK newspaper linker command failed with exit

Code1 (use-v to see invocation)

Because of the repeated introduction of the Libtcweibosdk class library, Targets-project-build Phases-link Binary with libraries, there are three libtcweibosdk, can delete libtcweibosdk-i386.a

11:nsuserdefaults Store min nsdictionary

Note: The data types supported by Nsuserdefaults are NSString, NSNumber, NSDate, Nsarray, Nsdictionary, BOOL, Nsinteger, Nsfloat, and other system-defined data types. Problem encountered this time: when the value inside the nsdictionary is null, the Nsuserdefaults is reported as an exception (attempt to insert Non-property List object); Workaround: Filter the values in the dictionary , empty to convert null values into strings; The code is as follows (create an extension Class): @implementation nsdictionary (Common)-(nsdictionary *) changedictionarynotnill{    Nsmutabledictionary *muresult=[[nsmutabledictionary Alloc]init];    Nsenumerator *enumerator=[self Keyenumerator];    ID key;    while ((Key=[enumerator Nextobject]) {        ID value=[self objectforkey:key];        if ((NSNull *) value==[nsnull null]) {            [Muresult setobject:@ "" Forkey:key];        }        else        {            [Muresult setobject:value forkey:key];        }    }    return muresult;} @end

iOS Development Basics-Fragmentation 8

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.