Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-17-2011, 11:02 AM   #1 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default scrolling a UIScrollView on the click of a button

Hi,

I would like to know if it is possible for me to scroll a UIScrollView on the click of a UIButton and if so, would someone be able to tell me how to.

currently I am using the below code to see if in the scrollview more content is there to its left and if it is there, display an image which would tell the users that there is more content if they scroll to the left.
I would like to implement a functionality where I add a UIButton instead of the image and when more content is available on the left and when the user clicks the button, the scrollview would scroll to its left.

Code:
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
        if (scrollView1.contentOffset.x == scrollView1.contentSize.width - scrollView1.frame.size.width) 
        {        
            // reached the right
            self.imageView.hidden = YES;
        }
        
        else
        {
            self.imageView.hidden = NO;
        }
    }
It would be great if someone could help me out on this.
ashwinr87 is offline   Reply With Quote
Old 06-17-2011, 11:06 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Yes, it is possible to scroll the scrollview on the click of a button. Check out the UIScrollView Class Reference, specifically the part about "Managing Scrolling". You will find what you need there to make this happen.
smithdale87 is offline   Reply With Quote
Old 08-16-2011, 04:15 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 21
famictech2000 is on a distinguished road
Default

Quote:
Originally Posted by ashwinr87 View Post
Hi,

I would like to know if it is possible for me to scroll a UIScrollView on the click of a UIButton and if so, would someone be able to tell me how to.

currently I am using the below code to see if in the scrollview more content is there to its left and if it is there, display an image which would tell the users that there is more content if they scroll to the left.
I would like to implement a functionality where I add a UIButton instead of the image and when more content is available on the left and when the user clicks the button, the scrollview would scroll to its left.

Code:
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
        if (scrollView1.contentOffset.x == scrollView1.contentSize.width - scrollView1.frame.size.width) 
        {        
            // reached the right
            self.imageView.hidden = YES;
        }
        
        else
        {
            self.imageView.hidden = NO;
        }
    }
It would be great if someone could help me out on this.


Hello Have you been able to figure this out yet? If so can you please post yoru code.
famictech2000 is offline   Reply With Quote
Old 08-16-2011, 04:39 PM   #4 (permalink)
Super Moderator
 
Join Date: Jan 2011
Posts: 434
Rhade is on a distinguished road
Default

Quote:
Originally Posted by famictech2000 View Post
Hello Have you been able to figure this out yet? If so can you please post yoru code.
I want an explanation for this very quickly or your account will be banned. I'm not sure what game you're playing, but I don't like it.

Quote:
Originally Posted by famictech2000 View Post
I would like to know if it is possible for me to scroll a UIScrollView on the click of a UIButton and if so, would someone be able to tell me how to.

currently I am using the below code to see if in the scrollview more content is there to its left and if it is there, display an image which would tell the users that there is more content if they scroll to the left.
I would like to implement a functionality where I add a UIButton instead of the image and when more content is available on the left and when the user clicks the button, the scrollview would scroll to its left.

Code:
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
        if (scrollView1.contentOffset.x == scrollView1.contentSize.width - scrollView1.frame.size.width) 
        {        
            // reached the right
            self.imageView.hidden = YES;
        }
        
        else
        {
            self.imageView.hidden = NO;
        }
    }
It would be great if someone could help me out on this.
Quote:
Originally Posted by ashwinr87 View Post
Hi,

I would like to know if it is possible for me to scroll a UIScrollView on the click of a UIButton and if so, would someone be able to tell me how to.

currently I am using the below code to see if in the scrollview more content is there to its left and if it is there, display an image which would tell the users that there is more content if they scroll to the left.
I would like to implement a functionality where I add a UIButton instead of the image and when more content is available on the left and when the user clicks the button, the scrollview would scroll to its left.

Code:
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
        if (scrollView1.contentOffset.x == scrollView1.contentSize.width - scrollView1.frame.size.width) 
        {        
            // reached the right
            self.imageView.hidden = YES;
        }
        
        else
        {
            self.imageView.hidden = NO;
        }
    }
It would be great if someone could help me out on this.
Rhade is offline   Reply With Quote
Reply

Bookmarks

Tags
ios, ipad, uibutton, uiscrollview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 325
6 members and 319 guests
chemistry, Dnnake, iOS.Lover, lendo, Leslie80, pbart
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:24 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0