objective c - IOS: change UIImageView with tag value -


i have 20 uiimageview , want change image; don't want create 20 iboutlet, , want use tag value change image; set tag value in interface builder , after? if want change image @ imageview number 15? how can do?

if use tags can identify tagged view (uiimageview subclass of uiview, has tag attribute) this:

- (uiview *)viewwithtag:(nsinteger)tag 

so if call method on superview (which uiimageviews reside in), should this:

uiimageview *myimageview = (uiimageview *)[myawesomesuperview viewwithtag:15]; 

(documentation found using google).

p.s: if think work add 20 iboutlets, recommend create uiimageviews programmatically well. way not need xib file @ all, write small piece of code , have better maintenance less effort.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -