Up until updating Xcode last night, this was working great (though probably through sheer dumb luck!).
I’m getting an error now for my UITextViews, Fields and UIPickerViews when assigning the delegate:
[m_textField setDelegate:GAMESTATE->glView.self];
m_textField is defined as UITextField*. glView is defined as a UIView*. To keep things simple, I’m using just one UIView for the entire app (could also be a problem). I only need access to a couple of basic operations in the app to get simple text info from the user. Now I get the error:
Cannot initialize a parameter of type 'id<UITextFieldDelegate>' with an rvalue of type 'UIView*'
Like I said, I probably was doing something wrong in the first place, and it only worked through sheer, dumb luck! If it helps, I’m already subclassing my UIView as an Accelerometer Delegate, as such:
@interface GLView : UIView <UIAccelerometerDelegate>
Any help, suggestions or tips would be greatly appreciated. I’ve stumbled through some books this morning and brushed up on several Apple docs, but a quick work-around doesn’t seem possible. I’m not adverse to refactoring the way I take input from the user, I could just use a hand getting there.
You should create, for example,
NSObjectthat will delegateUITextView:UITextViewDelegate.UIPickerView:UIPickerViewDelegateYour class declaration should look like this:
Then you should alloc+init it and set it as delegator of your text/picker views:
Don’t forget to implement appropriate methods in
MyViewDelegatorthat are not optional for protocols.