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;
- Pull up load more
- -(void) scrollviewdidenddragging: (uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{
- [_refreshheaderview Egorefreshscrollviewdidenddragging:scrollview];
- float Offset=scrollview.contentoffset.y;
- float contentheight=scrollview.contentsize.height;
- float Sub=contentheight-offset;
- if ((scrollview.height-sub) >20) {//If the pull-up distance is more than 20p, load more data
- [Self loadmoredata];//here to load more data at the bottom of the view
- }
- }
Some useful little features that are encountered during iOS learning (8/13 update)