objective c - Creating a delegate and dataSource for UIPickerView -


I am trying to create a rep and a data source for a UIPickerView in a separate file. I have in ViewController:

  - (zero) viewDidoadload {[Super Viewedload]; UIPickerView * myPickerView = [[UIPickerView alloc] initWithFrame: CGRectMake (0, 200, 320, 200)]; Month Picture * Month Picture = [[Month Picker Alok] Init]; MyPickerView.delegate = monthPicker; MyPickerView.dataSource = monthPicker; MyPickerView.showsSelectionIndicator = Yes; [Self.view addSubview: myPickerView]; }   

MonthPicker.h

  #import & lt; UIKit / UIKit.h & gt; @interface monthPicker: NSobes & lt; UIPickerViewDelegate, UIPickerViewDataSource & gt; @end   

MonthPicker.m

  #import "MonthPicker.h" @implementation MonthPicker - (NSInteger) pickerView: (UIPickerView *) pickerView numberOfRowsInComponent :( NSInteger) component {return 7; } - (NSInteger) numberOfComponentsInPickerView: (UIPickerView *) Pickbackview {return1; } - (NSString *) pickerView: (UIPickerView *) pickerView titleForRow: (NSInteger) forComponent: (NSInteger) component {"yyy" returned @; } @end   

At this time I'm just using the placeholder values ​​to make a representative work. Everyting is compiled properly, but when I run the app and see that it's the picker to go to, it crashes with the 0 error message in the console

The only message I get is: Thread 1: EXC_BAD_ACCESS (code = 2, address = 0x0) but it does not help me at all.

I also tried to override the dealloc method in the delegation with an NSLog, and it appears that before the accident, it is removed, which is very strange to me looks like.

What am I missing?

Thank you.

itemprop = "text">

The problem may be that at the end of viewDidLoad



Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -