Bir gezinme çubuğunun sağ tarafına 2 düğme dizisi eklemeye çalışıyorum, ancak kodu çalıştırdığımda bir istisna alıyorum.navigationIntem.rightBarButtonItem sonuçlarına bir dizi UIButtons ekleme NSInvalidArgumentException
'NSInvalidArgumentException', nedeni: '- [UIButton isSystemItem]: tanınmayan seçici örneğine gönderilen
Kodum gerçekten oldukça basittir: Ben iPhone 5.0 üzerinde çalıştırıyorum
UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,100,45)];
label.backgroundColor=[UIColor clearColor];
label.text = @"Test 2 Buttons";
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
button1.frame = CGRectMake(00.0f, 0.0f, 32.0f, 32.0f);
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
button2.frame = CGRectMake(00.0f, 0.0f, 32.0f, 32.0f);
NSArray *rightBarButtons = [[NSArray alloc] initWithObjects:button2, button1, nil];
UINavigationItem* navItem = self.navigationItem;
navItem.titleView = label;
navItem.rightBarButtonItems = rightBarButtons;
[rightBarButtons release];
[label release];
simülatör. Herhangi bir fikir? Şimdiden teşekkürler. Al
Cevabınız için teşekkür ederiz. Bunu fark etmeliydim. Çok basit :-) – Alan
"UIButton" uBarButtonItem ile değiştirin ve işe yarıyor. 'InitWithCustomView' ile oluşturmanıza gerek yoktur. UIBarButtonItems dizisini "self.navigationItem.rightBarButtonItemS" öğesini –
@ proca2.0 bitiminde ** S ** olarak atadığınızdan emin olun, bu nedenle ** "Veya, düğmelerinizdeki değere bağlı olarak, çubuk düğmesi oluşturun. doğrudan öğeler. "** – jrturton