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

7 Benefits of Data Visualization

Data visualization refers to the presentation of ...

There is still a lot of hurdles for VR movies to overcome.

For most people, virtual reality movies can be de...

The support behind the safety and reliability of new energy vehicles

Despite the decline in subsidies, the investment ...

JD Finance 618 operation and promotion strategy!

On June 19, a newcomer appeared at the top of the...

Do you care about what others think?

© The Good Men Project Leviathan Press: “You will...

Tips and strategies for placing Weibo Fans Advertising!

The eyewear industry has reached a historical jun...

Product Operations: How to Develop a Growth Plan for Your Product!

After the concept of growth hacking was introduce...

Is the milk you bought pure? These three numbers on the box reveal the secret

Review expert: Wang Guoyi, Postdoctoral Fellow in...