Wednesday, May 19, 2010

Data flow communication between UIViews

There are many ways for two UIViews to exchange data between them. Below list a few of them:

1. Global variable
    This is the least desire way, though it is probably the easiest way. However, this way is most difficult to
    maintain. With this, it is almost impossible to know which UIViews are related. When changes make to
    one, it is also very difficult to assess which other will be impacted.

2. Message passing
    Public variable can be setup in the UIViews. Setter method can be automatically generated by using the
    @synchronize keyword. The setter method can be invoke to pass the message.
    Eg.
                  UIView.title=@"Testing";

3. Delegate
    Setup delegate interface in the UIView that will be call when there are event changes in the calling 
    UIView.

1 comment:

  1. Nice and very helpful information i have got from your post. Even your whole blog is full of interesting information which is the great sign of a great blogger.

    Lenovo - IdeaPad 15.6" Laptop - 6GB Memory - 1TB Hard Drive - Dark Chocolate

    Lenovo - 14" Notebook - 4 GB Memory - 320 GB Hard Drive - Black

    ReplyDelete