Some of the best tricks for iOS development

Some of the best tricks for iOS development

Some tips for iOS

What should I do if TableView does not display cells with no content?

Like this, I don't want the empty space below to be displayed.

It's very simple.

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

Those who have tried it say it's good.

After adding this sentence, it becomes like this.

What should I do if the left swipe back gesture of the customized leftBarbuttonItem fails?

  1. self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
  2. initWithImage:img
  3. style:UIBarButtonItemStylePlain
  4. target:self
  5. action: @selector (onBack:)];
  6. self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;

What should I do if ScrollView cannot scroll to the top of the viewController for unknown reasons?

  1. self.automaticallyAdjustsScrollViewInsets = NO;

I am so annoyed by the keyboard events I wrote that I want to throw the keyboard. What should I do?

  1. Buy a solid keyboard.
  2. I used IQKeyboardManager (searchable on github), and my waist and legs no longer hurt after using it.

Why is my app always stuck? What went wrong?

As shown

This artifact is called: KMCGeigerCounter
Go to GitHub and move it.

How to adjust the position of separaLine without creating a new Cell?

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

How do I close the keyboard by clicking on self.view? Do I need to add a tapGestures?

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

How to set a default background image for each ViewController?

Use the base class, boy.

I want to change the layoutAttributes added in the xib in code, but how can I find it in code?

Pull your constraints like you would a button. NSLayoutAttribute can also pull lines.

How to hide the navigationbar when sliding like Safari?

navigationController.hidesBarsOnSwipe = Yes

The title of the back button on the navigation bar is so annoying, how can I make it disappear?

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

CoreData is annoying to use, and the syntax is long and ugly. What should I do?

MagicalRecord

How does CollectionView implement a hovering header like tableview?

CSStickyHeaderFlowLayout

<<:  Schools of programming

>>:  Is it Lanxiang again? A major bug appeared in WeChat's "group chat" function

Recommend

Was the crocodile that Han Yu drove away the Han Yu crocodile?

In 819 AD, during the reign of Emperor Xianzong o...

Hericium erinaceus, does it look like a monkey head?

The Food and Agriculture Organization of the Unit...

Probiotic drinks? They sound healthy, but they may just be sugar water!

Everyone is familiar with probiotics. Advertiseme...

How can operations break through product bottlenecks?

The product has hit a bottleneck and the order vo...

The copywriting of Hammer phone has never let me down

April 9th, today is the new product launch confer...

How to add words after tap on WeChat? Tutorial on adding text after tap

How can I add longer text after tapping on WeChat...

Have you noticed that there are fewer and fewer fireflies around us?

Have you noticed that there are fewer and fewer f...

Internet celebrity brands seek change and fight back!

As the year 2021 is about to pass, the new consum...

Apple has come up with a patent to make the iPhone waterproof

Apple is considering designing a waterproof iPhon...

In the first year of VLOG marketing, how can brands catch this express train?

Introduction: As a new trend, public opinion has ...

Use these 6 tips to make users want to buy your product

Some time ago, I saw that another restaurant near...