Search code examples
cocoa-touchxcoderandom-access

switch to randomly selected view in xcode


utilising xcode using the random function i want to switch to from a view to a randomly selected new view...can some one give me some direction.


Solution

  • A new view (randomly selected) subview of the current view or some view across your application?

    For subviews: you could use the tag property of every view, assign a value to it and use viewWithTag: to find a view based on the tag (= the randomly generated number from before).

    For views across your app: Why would you want to do something like this? Doesn't sound exactly like good design to me.