iOS 앱을 처음 사용합니다. 현재 nib 파일을 변경하는 앱을 만들고 있습니다.iOS -h 파일에서 UIToolbar가 작동하지 않습니다.
그러나 XIB 사용자 인터페이스를 사용하여 새 UIViewController 하위 클래스를 만든 후에는 UIToolbar IBOutlet을 사용할 수 없습니다.
그것은 바보 같은 소리 수 있지만 "UIToolbar는"헤더 파일에서 보라색/분홍색 갈 나던 (.H) :
@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
을도 아니다 "는 _toolbar"는에, 녹색/청색 이동하지 .m :
@synthesize toolbar = _toolbar;
이것은 내가 UIToolbar를 사용하는 데 문제가되고 있습니다.
다음은 .H 내 코드입니다 :
#import <UIKit/UIKit.h>
@interface pedestrians : UIViewController;
@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
@end
그리고하는 .m을 위해 :
#import "pedestrians.h"
@implementation pedestrians
@synthesize toolbar = _toolbar;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
@end
어떤 도움도 좋은 것입니다. 감사.
편집 :
그냥 (되지 않은 UI 물건을 따기)이 같은 UIBar 버튼을 추가하려고 :
nib 파일에 IBOutlet 속성과 도구 모음을 연결 했습니까? –
도구 모음 - 파일 소유자 - 예. – ryryan