iphone sdk 3.0 - What is the difference between .tag and tag -
i have query on this. please @ sample code below:
uibutton *button; button.tag = 1;
and
int = (int)[(uibutton*)sender tag];
the first line set tag number 1 button variable, using .tag method. , in second line, used (int)[(uibutton*)sender tag];
extract , cast sender integer value. question be, difference between .tag , tag method?
there should no difference. before objective c 2.0, dot methods didn't exist; these added, function shortcuts longer bracketed call.
in particular code example, in first code block, button
doesn't hold pointer button. you'd need call
uibutton *button = [uibutton buttonwithtype:uibuttonroundedrect]; button.tag = 1;
this set tag 1. second code block takes existing button , extracts tag int
, indicated. better example of parallel methods be:
button.tag = 1;
, [button settag:1];
, or
int tag = button.tag;
, int tag = [button tag];
Comments
Post a Comment