Some useful little features that are encountered during iOS learning (8/13 update)

Source: Internet
Author: User

These are some of the things I've encountered in my current UI learning process that I've developed that will be more versatile.

First of all, in the next learning process if you find that useful features will continue to update

Because or novice, if there are any problems please leave a message to tell me, I will correct

1.

Click Return on the keyboard to end the edit, retract the bottom keyboard

The following methods are used in the. m file (to first introduce the protocol in the header file: uitextfielddelegate)

-(BOOL) Textfieldshouldreturn: (Uitextfield *) textfield{    [TextField resignfirstresponder]        //  end Edit, retract bottom keyboard    return  YES;

2.

Click End Edit except the input box to retract the bottom keyboard method

Textfiled.delegate = self;

(1), first define a Uicontrol, the size of the entire screen (or a large screen)

(2), put the uicontrol below the input box (with Insertsubview:belowsubview)

(3), add trigger event to Uicontrol

(4), in the event method reference [(Uitextfield *) Resignfirstresponder];

3.

When the bottom keyboard pops up, a button or other view that is originally located at the bottom keyboard position moves

First look at the original effect:

(1), subscribe to the keyboard to raise the system notification:


object: nil];

(2), implement the Keyboardshow method, move the button up (can add animation)

-(void) keyboardshow{    [UIView animatewithduration:0.5 animations:^{        = CGRectMake (340);    // shorten the height        of TextField Btn.frame = CGRectMake (370355);            // move button up    } completion:^(BOOL finished) {            }];}

(3), to this point, completed the move up step, next, to complete the cancellation of input, move down the steps

(4), ibid. system notification when subscribing to a keyboard drop

object: nil];

(5), the realization Keyboardhide method, restores the position:

-(void) keyboardhide{    [UIView animatewithduration:0.5 animations:^{        = CGRectMake (340);    // to bring TextField back to its original height.        Btn.frame = CGRectMake (355);            // make button Move Down    } completion:^(BOOL finished) {    }];}

15/8/13

4. Remove the border black line from the navigation bar

In the Viewdidload

[Self.navigationController.navigationBar setbackgroundimage:[[uiimage Alloc]init] Forbarmetrics: Uibarmetricsdefault];

Self.navigationController.navigationBar.shadowImage = [[UIImage alloc]init];

5. Remove the border black line from the search box

In Viewdidload

[Self.textsearchbar setbackgroundimage:[[uiimage Alloc]init];

6. Remove the shadow from the text input box of the search box

Again storyboard, check the search box to change the color of the view tint to clearcolor;

  1. Pull up load more
  2. -(void) scrollviewdidenddragging: (uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{
  3. [_refreshheaderview Egorefreshscrollviewdidenddragging:scrollview];
  4. float Offset=scrollview.contentoffset.y;
  5. float contentheight=scrollview.contentsize.height;
  6. float Sub=contentheight-offset;
  7. if ((scrollview.height-sub) >20) {//If the pull-up distance is more than 20p, load more data
  8. [Self loadmoredata];//here to load more data at the bottom of the view
  9. }
  10. }

Some useful little features that are encountered during iOS learning (8/13 update)

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.