Results 1 to 2 of 2
Discuss random generated number view at the iPhone Developer Exchange - Hackint0sh.org; hi this may be considered a dumb question it just that iv been going around ...
  1. #1
    Newbie Array

    Join Date
    Jul 2010
    Location
    australia
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default random generated number view

    hi this may be considered a dumb question it just that iv been going around in circles for a bit now and im sure the solution is simple. i was playng around with an idea. in a single lable in a view when the view appears a random number is displayed. presently i have aview, a lable and a button. press button random number is generated and the lables title is replaced with a random number....random number displayed.

    what i wish to acheive is that there is no button, just a view and a text lable and when the view appears a random number is displayed also instantaneously with out the need for a button to prompt generation.
    here isi the code i have so far
    #import "Mainview.h"

    @implementation Mainview
    - (IBAction)pushstart {

    NSString *title = nil;
    NSString *path = nil;

    int Number = arc4random() % 12;
    switch(Number) {
    case 0:
    namel.text = @"1";

    break;
    case 1:
    namel.text = @"2";

    break;

    case 2:
    namel.text = @"3";

    break;

    case 3:
    namel.text = @"4";

    break;

    case 4:
    namel.text = @"5";

    break;
    case 5:
    namel.text = @"6";

    break;

    case 6:
    namel.text = @"7";

    break;

    case 7:
    namel.text = @"8";

    break;

    case 8:
    namel.text = @"9";

    break;



    case 9:
    namel.text = @"10";

    break;

    case 10:
    namel.text = @"11";

    break;

    case 11:
    namel.text = @"12";

    break;


    break;
    default:
    break;
    }


    }
    @end



  2. #2
    Newbie Array

    Join Date
    May 2010
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    you will find an example for generate a random number in this site at Download examples
    Cocoa® Programming for Mac® OS X (3rd Edition)

 

 

Similar Threads

  1. Replies: 2
    Last Post: 08-10-2009, 11:45 PM
  2. View to View NSUserDefault - Source code included
    By jjgraz in forum iPhone Developer Exchange
    Replies: 0
    Last Post: 03-07-2009, 10:54 PM
  3. Replies: 1
    Last Post: 07-25-2008, 02:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 09:20 AM.
twitter, follow us!