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

UK plans to publish confidential letter that convinced Nissan to stay

According to foreign media reports recently, Brit...

Apple's decline

"Is there any signal?" two Apple users ...

7 practical skills for attracting private traffic to Xiaohongshu

Now that the traffic dividend has disappeared and...

Five core points: How to carry out refined operations of mobile games

[[129440]] Mobile game operation can be understoo...

Operations = miscellaneous tasks? 90% of operators are going astray!

A few days ago, a colleague from my previous team...

Five major schools of brand IPization!

IP, which stands for Intellectual Property, origi...

How to build a good reputation for a product during its introduction period?

Today let’s talk about a not very interesting que...

A comprehensive summary of design anomalies and how to handle them

In design, some abnormal situations are often eas...

Community Operation | Master these 3 steps to make your community "live"

People always think that their own communities ar...