2017-06-13 57 views

回答

0

您可以使用工具欄爲UITextfield的accessoryView的與UIBarButtonSystemItemCamera

toolbar = [[UIToolbar alloc] init]; 
    toolbar.barStyle = UIBarStyleBlackOpaque; 
    [toolbar sizeToFit]; 
    toolbar.frame = CGRectMake(0, 436, 320, 44); 
    UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; 
    spaceItem.width = 130.0; 
    UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(captureBarItemPressed:)]; 
    NSArray *items = [NSArray arrayWithObjects: spaceItem, cameraItem, nil]; 
    [toolbar setItems:items]; 

txtField.inputAccessoryView = toolbar 
相關問題