如何在iphone上的uinavigationbar上创建信息按钮

Atm*_*tma 12 iphone cocoa-touch uinavigationbar

我已经看到很多应用程序在uinavigationbar上有一个信息按钮(字母"i",周围有一个圆圈).如何添加此类按钮?

Bla*_*ers 31

之前的答案很接近,没有完全编译.这是你真正想要的:

// Info button
UIButton* infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; 
[infoButton addTarget:self action:@selector(showInfoView:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
Run Code Online (Sandbox Code Playgroud)