English 中文(简体)
Hide/Unhide UINavigationbar, 当屏幕被利用时
原标题:Hide/Unhide UINavigationbar when the screen is tapped

I m非常新颖的SOS发展公司,我刚刚在我的西比档案中制作了一部<条码>:纳吉特·巴尔<代码>,我想在用户(如照片)利用一部分屏幕时隐藏/how。 我在网上发现了一些幻灯,但我不知道如何使用。

如果有人能向我提供详细信息,说明如何做到这一点,我不胜感激。

最佳回答

在贵方言中,在任何地方都添加这种 to。 这在第一大街上藏匿,在第二大街上再次露面。

- (void)toggleNavBar:(UITapGestureRecognizer *)gesture {
    BOOL barsHidden = self.navigationController.navigationBar.hidden;
    [self.navigationController setNavigationBarHidden:!barsHidden animated:YES];
}

如果没有导航控制器,将航道与IBOutlet连接起来,替换为

- (void)toggleNavBar:(UITapGestureRecognizer *)gesture {
    BOOL barsHidden = self.navBar.hidden;
    self.navBar.hidden = !barsHidden;
}

然后在<代码>-(撤销)viewDidLoad中添加以下内容:{}

UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleNavBar:)];
[self.view addGestureRecognizer:gesture];
[gesture release];

如果要主人的看法是: 观点主计长必须把议定书添加到观点控制器上,并把它作为代表列入<条码> 姿态.delegate = 自我;后添加如下内容:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    return YES;
}

之所以需要这一点,是因为国际交易日志管理人已经实施自己的姿态识别器。

问题回答

归根结底,你要向您的航标发出-setHidden:。 在您看来,这样做最容易的方式是把Outlet<>m>和Action列入你的控制员。 然后,在您的书目中,将航道与散射线连接起来,并将一些纽州(甚至一个大型、完整的屏幕)与行动联系起来。

Outlets and Actions are basic techniques used over and over in iOS (and Mac) programming, so if you don t understand them, best go read up on them now. Every beginning iOS/Mac programming book covers this topic as does Apple s own Getting Started guide (pay particular attention to the Configuring the View section).

在你的行动中,向散列发出这样的信息:

-(void)myButtonAction:(id)sender{
  [[self myNavigationBarOutlet] setHidden:YES];
}

每当你吨被开发时,这将掩盖航道。

(假设有<条码>。) Bar , 如同你所说的那样。 如果你重新使用管理自己的<条码>的“冻结令”/代码,这些指示将有所不同。 Bar





相关问题
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 ...