English 中文(简体)
我是否需要为每一项倡议创造变量和连接IBOutlet?
原标题:Do I need to create variables and link IBOutlet for every UIVIew?

我有一位主计长,正在对《国际调查评论》中和外的物体进行pping击。 可能有数百种不同的观点,每种观点都有自己的行为。

在我目前的主要档案中,我有:

File s Owner     UIApplication
First Responder  UIResponder
AppDelegate      AppDelegate
  -Cover         Cover
Window           UIWindow
Table of Contents  TableOfContents
page1            Page1
page2            Page2
page...n         Page...n

推荐人宣布窗户和主计长。 它是很基本的。

MainViewController.h

#import <UIKit/UIKit.h>


@class TableOfContents, Page1;

@interface MainViewController : UIViewController {

    TableOfContents *tableOfContents;
    Page1 *page1;
    Page2 *page2;
    Page...n *page...n;
}

@property (nonatomic, retain) IBOutlet TableOfContents *tableOfContents;
@property (nonatomic, retain) IBOutlet Page1             *page1;
@property (nonatomic, retain) IBOutlet Page2             *page2;
@property (nonatomic, retain) IBOutlet Page...n          *page...n;

-(IBAction)funcGoToPage:(id)sender;

@end

MainViewController.m

#import "MainViewController.h"
#import "TableOfContents.h"
#import "Cover.h"
#import "Page1.h"
#import "Page2.h"
#import "Page...n.h"

@implementation MainViewController

@synthesize page1, page2, page...n tableOfContents;
@synthesize pageID, pagesPathFile, pagesPath;


-(IBAction)funcGoToPage:(id)sender{

    //[[self view] removeFromSuperview];
    [self.view addSubview:self.tableOfContents];
}

此时此刻,相应的《国际调查》课程基本上没有上课,因此我没有上课。

现在是时候了。 OfContents. 最后,根据被点击的情况,我不得不前往不同的地方。

目前,每一页均作为IBOutlet,与Centrent Controller在Interface Buildinger的“ID”有关。 否则,每一页都必须作为变数建立起来,并与创建变数、插头和连接的中枢连接起来。

我的问题是:是否有办法在传单上建立这些联系,以便我能够利用我的“志愿人员”职能,而不将其设置为“IBOutlet”?

最佳回答

当装满了它的所有内容时。 如果你在一刀子中有很多观点,你就会很快失去记忆。

I would put each page in a seperate nib and then load the nib when required: [[NSBundle mainBundle] loadNibNamed:@"nibNameWithoutExtension" owner:self options:nil];

为此:

  • add an IBOutlet, eg newPage, to whatever self refers to
  • set the File Owner in nibNameWithoutExtension to whatever self refers to
  • join the view in nibNameWithoutExtension to the newPage outlet of File Owner
问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签