iOS work notes (14)

Source: Internet
Author: User

1.scrollview frame refers to its visual range, contentsize refers to its scroll range, respectively, in the horizontal and vertical direction of the

So to let the scrollview in the horizontal direction cannot scroll, then needs the following setting

_scrollview = [[Uiscrollview alloc]initwithframe:cgrectmake (00= Cgsizemake (0, kscreenheight*3);

To enable the ScrollView to scroll, the properties of the contentsize in one Direction are larger than the frame, otherwise the scrolling area is small and the content can be displayed all without scrolling.

2. Set the Uicollectionview to the left and right sides of the screen, you can use

-(Uiedgeinsets) CollectionView: (Uicollectionview *) CollectionView layout: (Uicollectionviewlayout *) Collectionviewlayout Insetforsectionatindex: (nsinteger) section{    return Uiedgeinsetsmake (0  0); // top, left, bottom, right, respectively

Before adding the method

After you add the method

The above method and

0;

These two properties to co-regulate the location of the Uicollectionview cell

3. Change the keyboard return to send, you can use

Self.myTextView.returnKeyType = Uireturnkeysend;

However, there is still a problem, click Send is still a newline, should do processing

-(BOOL) TextView: (Uitextview *) TextView Shouldchangetextinrange: (nsrange) Range Replacementtext: (NSString *) text {    if ([text isequaltostring:@ "\ n"])        {return // make return key invalid     }    return  YES;

To listen for the Send event is also in the above method

-(BOOL) TextView: (Uitextview *) TextView Shouldchangetextinrange: (nsrange) Range Replacementtext: (NSString *) text {    if ([text isequaltostring:@ "\ n"])        {//  Send event handling         [Self.mytextview resignfirstresponder];         return // make return key invalid     }    return  YES;

4. In TableView, if you want to select a line by default when you enter, you can use

[Self.firsttabelview selectrowatindexpath:indexpath                                         animated:no                                   scrollposition: Uitableviewscrollpositionnone];

iOS work notes (14)

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.