URGENT: content size exceeds screen resolution size!

Discussion in 'iOS Programming' started by ilx.mac, May 20, 2009.

  1. ilx.mac macrumors member

    Joined:
    Mar 10, 2009
    #1
    Hi there, i have a UIView in place. i am displaying some labels & textview. Its exceeding the screen resolution size. Is there some thing to scroll & view the entire screen. I have attached my screen for reference.

    Thanks in Advance!
     

    Attached Files:

  2. Svinja macrumors newbie

    Joined:
    Oct 27, 2008
    #2
    UIScrollView

    you add UISrollView to your view and then add all the controls to your scrollView. You must also set contentSize of the UIScrollView

    Example:
    Code:
    // Create scroll view(in viewDidLoad)
    UIScrollView *scrollViewTemp=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    scrollViewTemp.backgroundColor=[UIColor colorWithWhite:1.0f alpha:0.0f];
    self.scrollView=scrollViewTemp;
    [self.view addSubview:self.scrollView];
    [scrollViewTemp release];
    
    // Create your controls here and add them to the scrollView(with addSubview)
    
    // Set the scrolling height
    self.scrollView.contentSize=CGSizeMake(320,HEIGHT);
    
    
     
  3. ilx.mac thread starter macrumors member

    Joined:
    Mar 10, 2009
    #3
    thanks for the input svinja. I tried using your code.

    self.scrollView=scrollViewTemp;

    But i am getting error 'scrollview is some thing not a structure or union'.

    Any Inputs/Suggestions Please!
     
  4. BlackWolf macrumors regular

    Joined:
    Apr 9, 2009
    #4
    did you even create the scrollView property?
     
  5. ilx.mac thread starter macrumors member

    Joined:
    Mar 10, 2009
    #5
    I didn't. I am new to scrollview. can you help me on how to create it?
     
  6. ilx.mac thread starter macrumors member

    Joined:
    Mar 10, 2009
    #6
    Now Finally I got it to work.

    I Placed a scrollview on UIView using Interface Builder and the code below helped me to scroll.

    myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    myScrollView.contentSize = CGSizeMake(1800.0, 2300.0);
    [setvalue addSubview:myScrollView];
    [myScrollView release];

    Thanks for the response guys! Have a good Day!
     
  7. Svinja macrumors newbie

    Joined:
    Oct 27, 2008
    #7
    scrollView is a property,
    If you have self. in front of the word, it means it is a property(something like global variable)

    And one suggestion since i see you are begginer, stay away from interface builder, create your controls in code...just my opinion
     
  8. chbeer macrumors member

    chbeer

    Joined:
    Sep 22, 2008
    Location:
    Berlin
    #8
    ugh!! property != global variable!! property = field in object to store data/reference.

    ugh!! WRONG! As a beginner you should read one (or better more) books on Cocoa and iPhone dev. and/or have a look at the examples from Apple. And you should read about how the IB works before using it... but you should not avoid it!! (my opinion!)
     
  9. ilx.mac thread starter macrumors member

    Joined:
    Mar 10, 2009
    #9
    If [self.scrollview .. this appears then what u said was the thing, i supposed to do. But I am not getting that property after 'self.'. Thats why i opted to design it by IB. Is there any other way to do so. Please help with some code samples.

    Thanks in advance!
     
  10. Svinja macrumors newbie

    Joined:
    Oct 27, 2008
    #10
    i didnt write anywhere that property=global variable!!, i wrote "something like global variable" because i was trying to explain to him with something familiar since it is obvious he is beginner, but thanks for correcting me :)

    Everyone has an opinion, you cant say for opinion that is wrong, of course, every begginer should read some books but IB surely didnt help me in the beggining, nobody in my office uses IB anymore, too much time for nothing..
     
  11. chbeer macrumors member

    chbeer

    Joined:
    Sep 22, 2008
    Location:
    Berlin
    #11
    You are partly right with "global variable" because it is global to the object. But the problem for a beginner is, that he then tries to access the variable from another object and can't do that. Then he's puzzled.

    I didn't want to say your opinion is wrong but: for my opinion it is wrong to do everything without IB. Especialy for beginners it is a lot easier to "design" the screen and only code the logic behind it.

    My opinion is for beginner is: Buy and read Kochans Book 2nd edition. That is a gread intro to objective-c and he shows how to code a small iPhone program in one of the last chapters.
     

Share This Page