Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 具有相同操作的所有viewController的公共导航栏_Ios_Objective C_Uinavigationcontroller_Uinavigationbar - Fatal编程技术网

Ios 具有相同操作的所有viewController的公共导航栏

Ios 具有相同操作的所有viewController的公共导航栏,ios,objective-c,uinavigationcontroller,uinavigationbar,Ios,Objective C,Uinavigationcontroller,Uinavigationbar,我是iOS的新手。 我想设置显示在所有屏幕上并由导航控制器管理的导航栏,它调用相同的操作。如果您正在谈论让一些UIViewController添加相同的UINavigationItem,然后我将创建一个超类,添加UINavigationitem,并将UIViewControllers作为它的子类。使用下面的代码设置标题中的图像 UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];

我是iOS的新手。
我想设置显示在所有屏幕上并由导航控制器管理的导航栏,它调用相同的操作。

如果您正在谈论让一些
UIViewController
添加相同的
UINavigationItem
,然后我将创建一个超类,添加
UINavigationitem
,并将
UIViewControllers
作为它的子类。

使用下面的代码设置标题中的图像

UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
imgView.image = [UIImage imageNamed:@"image_name.png"];
self.navigationItem.titleView = imgView;

或者创建自定义方法并在每个控制器中调用它,以便在每个控制器中设置不同的标题徽标。

创建自定义导航控制器,设置其行为并在整个应用程序中使用它。是的,我已经尝试过,但无法从导航控制器中设置标题图像。