Set the tag property of the control , and then viewWithTag tag control using viewWithTag .
tag: an integer that can be used to identify view objects in the application.
Example
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.tag = 1; [myView addSubview:button];
Later, when you need to get / access the UIButton control:
UIButton* btn = [myView viewWithTag:1];
Remember that you can also set the
Tag property in the
.xib file (interface) in the attributes of the control.
see Apple UIView class reference tag property
source share