IOS Miscellaneous Pen-14 (owner forgotten)

Source: Internet
Author: User

*owner is now very seldom used in the development of interested children's shoes can see *

We meet owner usually in a similar

[[[NSBundle Mainbundle] loadnibnamed:@ "food" Owner:nil Options:nil]lastobject] encountered.

Our general practice is to set owner to self (usually when I customize the cell).

But when defining other controls, we need to think about why, or what we need to be aware of.

Here I begin to introduce owner.

First look at the contents of the GIF below:

It is not difficult to find that I am trying to drag the space is not successful, this is why???

Next look at the gif below

We dragged the control to success (Note * Here is why there is less use of owenr now, because the coupling of the line set is not good for improving coding efficiency)

Easy to use:

  viewcontroller.m//  CX forgotten owner////  Created by Ma C on 16/3/26.//  Copyright 2016 Xubaoaichiyu. All rights reserved.//#import "ViewController.h" @interface Viewcontroller () @property (weak, nonatomic) Iboutlet UIButton *foodone; @property (weak, nonatomic) Iboutlet UIButton *foodtwo; @end @implementation viewcontroller-(ibaction ) Foodoneaction: (ID) Sender {    NSLog (@ "Foodone");    } -(Ibaction) Foodtwoaction: (ID) Sender {    NSLog (@ "Foodtwo");} -(void) viewdidload {    [super viewdidload];    Self.view = [[[NSBundle Mainbundle] loadnibnamed:@ "food" owner:self Options:nil]lastobject];} @end

IOS Miscellaneous Pen-14 (owner forgotten)

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.