Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

abcdefg12345

macrumors 6502
Original poster
Jul 10, 2013
281
86
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;
    
}
 

abcdefg12345

macrumors 6502
Original poster
Jul 10, 2013
281
86
Are you saying you subclassed NSScrollView?

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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.