Reset Flipped NSScrollView

Discussion in 'Mac Programming' started by abcdefg12345, May 5, 2014.

  1. abcdefg12345 macrumors regular

    abcdefg12345

    Joined:
    Jul 10, 2013
    #1
    I have an app that contains a scrollview and buttons in it and as u know on mac when u build the scroll view it always starts on the button so i had to flip it then i made a button that is supposed to reset it so every time i click it the scroll view goes to the top but the problem is it keeps going to the bottom instead because its reversed is there a way i can make it reset to the top



    Code:
    NSPoint pt = NSMakePoint(0.0, [[ConverterScrollView1 documentView]
                                       bounds].size.height);
        [[ConverterScrollView1 documentView] scrollPoint:pt];
    i used this code to flip it
    flipped view.h
    Code:
    - (id)initWithFrame:(NSRect)frame
    {
        self = [super initWithFrame:frame];
        if (self) {
            // Initialization code here.
        }
        return self;
    }
    
    - (void)drawRect:(NSRect)dirtyRect
    {
    	[super drawRect:dirtyRect];
    	
        // Drawing code here.
    }
    
    -(BOOL)isFlipped {
        
        return YES;
        
    }
     
  2. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
  3. abcdefg12345 thread starter macrumors regular

    abcdefg12345

    Joined:
    Jul 10, 2013
    #3
    don't worry i got my answer

    Code:
    - (void)awakeFromNib{
        
        NSPoint pt = NSMakePoint(0.0, [[ScrollView documentView]
                                       bounds].size.height);
        [[ScrollView documentView] scrollPoint:pt];
        
    }
    - (IBAction)Reset:(id)sender
    {
            
    NSPoint pt = NSMakePoint(0.0, [[ScrollView documentView]
                                       bounds].size.height);
        [[ScrollView documentView] scrollPoint:pt];
    }
    that code makes scrollview start at the top and every time i click reset button it goes back to the top
     

Share This Page