我在UINavigationController中有一个UIWebView.我有一个TableView,当单击表格的单元格时,它会转到WebView,但是当用户在webview中单击文本字段时,键盘将不会显示.为什么不出现?需要哪部分代码?
此代码是下面向UIWebView过渡的一部分.
UIViewController *wvc = [[UIViewController alloc] init];
UIWebView *uiWebView = [[UIWebView alloc] initWithFrame: CGRectMake(0,0,320,480)];
[uiWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://sample/form.html"]]];
[wvc.view addSubview: uiWebView];
[self.navigationController pushViewController:wvc animated:YES];
Run Code Online (Sandbox Code Playgroud)
任何帮助是极大的赞赏.
我正在尝试向UINavigationController的导航栏添加2个按钮:
1)左侧的标准"后退"按钮 - 工作,和
2)右侧的"搜索"按钮 - 不显示.
这是代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// 1st button - this shows up correctly:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
backButton.title = @"MAIN";
self.navigationItem.backBarButtonItem = backButton;
// 2nd. button - this one does not show up:
UIBarButtonItem *searchButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSearch
target:self
action:@selector(goSearching:)];
self.navigationItem.rightBarButtonItem = searchButton;
itemsByTitleVC *itemsView = [[itemsByTitleVC alloc] initWithNibName:@"itemsByTitleVC" bundle:nil];
[self.navigationController pushViewController:itemsView animated:YES];
Run Code Online (Sandbox Code Playgroud)
}
谁知道为什么这不起作用?(对于它的价值,我正在使用Xcode 4.2,使用Storyboard ......)
iphone uinavigationcontroller rightbarbuttonitem uinavigationitem
是否可以将导航控制器标题设为按钮?但没有按钮看它.我希望它只是文本,如果你点击它,从底部弹出一个视图/动作表如果是这样,你能以编程方式告诉我如何使它成为一个按钮吗?谢谢
我正在使用UINavigation控制器在xCode 4.3.2中创建一个tabBar应用程序.我在AppDelegate中使用以下代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:
[[[UINavigationController alloc] initWithRootViewController:viewController1] autorelease], viewController2, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
现在问题是我想在导航栏中自定义背景图像.我找到的解决方案是编写UINavigationBar的子类并在接口构建器中设置新的子类.但在我的情况下,我以编程方式设置导航控制器,然后如何实现这一目标?我也尝试过创建类别
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, …Run Code Online (Sandbox Code Playgroud) 我知道这是一个重复的问题,但我仍然无法弄明白.当应用程序转到后台然后重新启动时,动画无效.应用程序第一次启动时我可以在视图之间获得推/动画动画,但是一旦应用程序转到后台,它就会停止动画制作.
我创建了一个自定义导航控制器类,在其中扩展UINavigationController和编写popViewControllerAnimated方法.
- (UIViewController *)popViewControllerAnimated:(BOOL)animated {
UIViewController* viewController = [super popViewControllerAnimated:animated];
UIViewController* nextViewControler = [[self viewControllers] lastObject];
[nextViewControler viewWillAppear:animated];
[viewController viewWillDisappear:animated];
return viewController;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
objective-c uinavigationcontroller ios5 popviewcontrolleranimated
我正在使用iOS 5 UINavigationBar的UIAppearance协议来自定义我的所有导航栏.
这是我的自定义功能:
- (void)customizeApperance
{
[[UINavigationBar appearance] setTintColor:[UIColor clearColor]];
[[UINavigationBar appearance] setAlpha:0.7];
UIImageView *titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"title.png"]];
[[UINavigationBar appearance] setTitleView:titleView];
}
Run Code Online (Sandbox Code Playgroud)
我有两个问题:
首先是颜色不是clearColor黑色.有什么建议?
标题视图根本没有出现.Ray Wenderlich通过添加:[[rootViewController navigationItem] setTitleView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"miniLogo.png"]]]in 来演示如何做到这一点applicationDidFinishLaunching.但问题是标题视图只会添加到根视图控制器中.我正在使用一个UINavigationController当我厌倦了替换rootViewControllerwith navigationController(我在AppDelegate中的导航控制器的名称)时,我根本看不到标题视图.我该如何解决这个问题?为什么不工作customizeApperance()?使用外观的关键不仅仅是创建一次标题视图(就像我在函数上面所做的那样)并且在所有导航栏中都是全局的吗?我怎样才能做到这一点?
iphone objective-c uinavigationbar uinavigationcontroller uiappearance
有没有办法在UINavigationController中禁用UINavigationItems上的所有触摸?
我正在寻找一种方法:
[self.navigationcontroller setDisabled:YES / NO];
Run Code Online (Sandbox Code Playgroud)
有一个简单的方法吗?
我正在尝试在触摸按钮时同时隐藏UITabBarController和UINavigationController.我在这里找到了一个非常好的代码片段如何隐藏uitabbarcontroller但是在尝试隐藏和动画UINavigationController和tabbarcontroller时我遇到了问题.我在互联网上发现了很多例子,当他们隐藏tabbar使用self.tabBarController.tabBar.hidden = YES但只隐藏按钮项而不是底部的黑条.
在玩了很多之后,我可以正确制作动画,因为我认为它与导航控制器的隐藏有关,这使得整个窗口的大小可以随时改变.
-(IBAction)touchImage:(id)sender {
if (isImageFullScreen) {
isImageFullScreen = NO;
[self.navigationController setNavigationBarHidden:NO animated:YES];
[UIView transitionWithView:self.view
duration:0.5
options:UIViewAnimationOptionCurveLinear
animations:^
{
hotelImageButton.frame = CGRectMake(0,20,320,92);
[self showTabBar:self.tabBarController];
}
completion:^(BOOL finished)
{
}];
} else {
isImageFullScreen = YES;
[self.navigationController setNavigationBarHidden:YES animated:YES];
[UIView transitionWithView:self.view
duration:0.5
options:UIViewAnimationOptionCurveLinear
animations:^
{
hotelImageButton.frame = CGRectMake(0,0,320,480);
[self hideTabBar:self.tabBarController];
}
completion:^(BOOL finished)
{
}];
}
Run Code Online (Sandbox Code Playgroud)
}
hideTabBar和showTabBar方法是我上面链接的其他帖子中的方法.
我也试过其他一些组合,但我不能让它看起来不错.有任何想法吗?
提前致谢.
uitabbarcontroller uinavigationcontroller uiviewanimation ios
在我的appDelegate中,在applicationDidFinishLaunching下,我有:
[self.navigationController setToolbarHidden:NO];
Run Code Online (Sandbox Code Playgroud)
在子视图中,在viewDidLoad下我有:
[self.navigationController setToolbarHidden:YES animated:YES];
Run Code Online (Sandbox Code Playgroud)
但是,在返回导航控制器时,工具栏仍保持隐藏状态.我已经尝试将它添加到RootViewController但没有成功.我无法弄清楚出了什么问题.
[self.navigationController setToolbarHidden:NO animated:YES];
Run Code Online (Sandbox Code Playgroud) CurrentViewController.h
#import <UIKit/UIKit.h>
#import "nextNavViewController.h"
@interface CurrentViewController : UIViewController
{
nextNavViewController *contr;
}
- (IBAction)showNavView:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
CurrentViewController.m
/*..........*/
- (IBAction)showNavView:(id)sender {
contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];
[self presentViewController: contr animated:YES completion:nil];
}
/* ......... */
Run Code Online (Sandbox Code Playgroud)
nextNavViewController.h
#import <UIKit/UIKit.h>
@interface nextNavViewController : UINavigationController
@end
Run Code Online (Sandbox Code Playgroud)
我有"nextNavViewController.xib",其中包含一个表,一些按钮和自定义导航栏.我希望加载此接口,但它加载空白屏幕的空白导航栏.
我正在做的事情是可能的吗?我需要做什么才能加载自定义界面?
iphone ×6
ios ×4
objective-c ×4
xcode ×2
ios5 ×1
macos ×1
toolbar ×1
uiappearance ×1
uitableview ×1
uiwebview ×1
xcode4.3 ×1