UIButtonType issue

I have created a UIButton by passing an integer value as this.

 UIButton* custom_newBackButton = [UIButton buttonWithType:101];
 [custom_newBackButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
 [custom_newBackButton setTitle:@"Back" forState:UIControlStateNormal];

 UIBarButtonItem* newBackButton = [[UIBarButtonItem alloc] initWithCustomView:custom_newBackButton];
 [[self navigationItem] setLeftBarButtonItem: newBackButton];

In some of the classes this works but some of the classes it fails with "Invalid conversion from int to UIButtonType". Is this a recommended way to handle this. I have simply use this 101 to get the back button look and feel.




The following button types are officially documented in the Apple documentation material:

typedef enum {
   UIButtonTypeCustom = 0,
} UIButtonType;

Enjoy! Please avoid using direct values. Values of constants might change and break your app.

Need Your Help

How to document Python code: Epydoc, doxygen, Sphinx, …?

python doxygen documentation-generation epydoc

I'm not sure if I should use Epydoc or doxygen for documenting my Python code. Currently I would prefer Epydoc since it's specialized to Python and it's syntax is not too different from doxygen's (...

Best practice for organizing automated testing?

unit-testing testing automated-tests

I am writing an automated testing for an application and currently have around 150 test cases. Everything runs fine, but as the tests keep growing, I continuously run into the problem of figuring o...