Some Kit Kat tricks developed by iOS

Source: Internet
Author: User

Original: http://www.cocoachina.com/ios/20141229/10783.html

TableView do not display the cell with no content?

Like this, I don't want to let the empty ones below show.

Very simple.

1 self.tableView.tableFooterView = [[UIView alloc] init];

Tried all the same.

After this sentence, it became.

What do I do if I customize the Leftbarbuttonitem left slide return gesture to fail?

123456     self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]                                         initWithImage:img                                         style:UIBarButtonItemStylePlain                                         target:self                                         action:@selector(onBack:)];self.navigationController.interactivePopGestureRecognizer.delegate = (id<uigesturerecognizerdelegate>)self;</uigesturerecognizerdelegate>

ScrollView inexplicable can not viewcontroller to the top how to do?

1 self.automaticallyAdjustsScrollViewInsets = NO;

Keyboard event Write good irritability, all want to fall keyboard, how to do?

1. Buy a sturdy keyboard.

2. Using Iqkeyboardmanager (GitHub searchable), the waist is not sore after use, the leg is not sour.

Why is my app always out of the flow and what's wrong with it?

This artifact is called: Kmcgeigercounter, go to GitHub to carry it.

How to adjust the position of separaline without creating a new cell?

1 _myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);

How to click Self.view to let the keyboard, need to add a tapgestures?

1234 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{   [self.view endEditing:YES];}

How to set the default background image for each viewcontroller?

Use the base class Ah, juvenile.

Want to change in the code in the Xib add layoutattributes, but how to use code to find AH?

Pull your restraints like a button. Nslayoutattribute can also pull the line.

How to hide navigationbar when sliding like safari?

1 navigationController.hidesBarsOnSwipe = Yes

Navigation bar return key The title of the belt is too annoying, how to let it disappear!

12 [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)                                                     forBarMetrics:UIBarMetricsDefault];

CoreData used to be very annoying, grammar and smelly and long, how to do?

Magicrecord

CollectionView How to realize tableview kind of hover header?

Csstickyheaderflowlayou

Can you use just one pan gesture instead of the uiswipegesture in all directions?

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 - (void)pan:(UIPanGestureRecognizer *)sender{typedef NS_ENUM(NSUInteger, UIPanGestureRecognizerDirection) {    UIPanGestureRecognizerDirectionUndefined,    UIPanGestureRecognizerDirectionUp,    UIPanGestureRecognizerDirectionDown,    UIPanGestureRecognizerDirectionLeft,    UIPanGestureRecognizerDirectionRight};static UIPanGestureRecognizerDirection direction = UIPanGestureRecognizerDirectionUndefined;switch(sender.state) {    caseUIGestureRecognizerStateBegan: {        if (direction == UIPanGestureRecognizerDirectionUndefined) {            CGPoint velocity = [sender velocityInView:recognizer.view];            BOOL isVerticalGesture = fabs(velocity.y) > fabs(velocity.x);            if(isVerticalGesture) {                if(velocity.y > 0) {                    direction = UIPanGestureRecognizerDirectionDown;                else{                    direction = UIPanGestureRecognizerDirectionUp;                }            }            else{                if(velocity.x > 0) {                    direction = UIPanGestureRecognizerDirectionRight;                else{                    direction = UIPanGestureRecognizerDirectionLeft;                }            }        }        break;    }    caseUIGestureRecognizerStateChanged: {        switch(direction) {            caseUIPanGestureRecognizerDirectionUp: {                [self handleUpwardsGesture:sender];                break;            }            caseUIPanGestureRecognizerDirectionDown: {                [self handleDownwardsGesture:sender];                break;            }            caseUIPanGestureRecognizerDirectionLeft: {                [self handleLeftGesture:sender];                break;            }            caseUIPanGestureRecognizerDirectionRight: {                [self handleRightGesture:sender];                break;            }            default: {                break;            }        }        break;    }    case UIGestureRecognizerStateEnded: {        direction = UIPanGestureRecognizerDirectionUndefined;           break;    }    default:        break;}}

How can I stretch a picture so that it doesn't deform?
1.UIImage *image = [[UIImage imagenamed:@ "xxx"] stretchableimagewithleftcapwidth:10 topcapheight:10];

2.


How to play GIF when this card, there is no better library?

Flipboard is good for you: Https://github.com/Flipboard/FLAnimatedImage

How to add a pull-up refresh in a sentence?

Https://github.com/samvermette/SVPullToRefresh

1234 [tableView addPullToRefreshWithActionHandler:^{// prepend data to dataSource, insert cells at top of table view// call [tableView.pullToRefreshView stopAnimating] when done} position:SVPullToRefreshPositionBottom];

How to change the color of the small tick of the cell in TableView to another color?

1 _mTableView.tintColor = [UIColor redColor];

Originally my statusbar is lightcontent, result with Uiimagepickercontroller will cause my statusbar style to turn black, how to do?

1234 - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];}

How do I make my navigationbar transparent instead of blurry?

1234 [self.navigationBar setBackgroundImage:[UIImage new]                         forBarMetrics:UIBarMetricsDefault];self.navigationBar.shadowImage = [UIImage new];self.navigationBar.translucent = YES;

How to change the color and position of Uitextfield placeholder?

Inherit Uitextfield, override this method

1234 - (void) drawPlaceholderInRect:(CGRect)rect {    [[UIColor blueColor] setFill];    [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];}

Why do you know so many strange tricks?

Go to StackOverflow brush problem ah, teenager!

Some Kit Kat tricks developed by iOS

Related Article

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.