i want creating uibarbutton without interface builder = (whit code) and this button is style camera please help me
Asked
Active
Viewed 1,147 times
1
-
i want creating in view did load – Milad Aug 24 '10 at 15:57
-
What do you mean by "this button is style camera"? – Shaggy Frog Aug 24 '10 at 16:09
-
I want to create programmatically a button like the one we see on the native iphone camera application when you want to take a picture – Milad Aug 24 '10 at 21:42
1 Answers
7
Objective-C:
UIBarButtonItem* cameraBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera
target:self action:@selector(myCameraAction)];
Swift:
let cameraBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Camera, target: self, action: "myCameraAction")
This will create a UIBarButtonItem with the system item icon of the camera.

DonnaLea
- 8,643
- 4
- 32
- 32