Iphone 如何在UINavigationBar中放置两个图像?
对于屏幕上的导航控制器,我想在导航栏中放置两个图像。有办法做到这一点吗?如果是,怎么做?一种方法是使用Iphone 如何在UINavigationBar中放置两个图像?,iphone,ios,Iphone,Ios,对于屏幕上的导航控制器,我想在导航栏中放置两个图像。有办法做到这一点吗?如果是,怎么做?一种方法是使用UINavigationItem.titleView和UINavigationItem.rightbuttonItem。像这样: viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]]; UIBarButtonItem *
UINavigationItem.titleView
和UINavigationItem.rightbuttonItem
。像这样:
viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage2.jpg"]]];
viewController.navigationItem.rightBarButtonItem = item;
这里我使用UIImageView
作为自定义视图,但它可以是带有自定义图像的UIButton
选中此项:
非常感谢,我的问题已经解决了。欢迎您随时光临。。