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

View Poll Results: Is this a good question?
Yes 3 50.00%
No 3 50.00%
A little empty 0 0%
Voters: 6. You may not vote on this poll

Reply
 
LinkBack Thread Tools Display Modes
Old 08-15-2010, 08:26 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 3
snrbrn is on a distinguished road
Exclamation how to use a page control???

I am trying to make an app where there are 10 pictures that you can scroll back and forth using a page control. The problem is I have absolutely no idea how to use a page control. Anyone with any help will be appreciated.
snrbrn is offline   Reply With Quote
Old 08-15-2010, 09:47 AM   #2 (permalink)
N3RD
 
Join Date: Oct 2009
Posts: 201
tychop is on a distinguished road
Default

PageControl
tychop is offline   Reply With Quote
Old 02-14-2012, 04:23 AM   #3 (permalink)
Amol Manwatkar
 
Join Date: Feb 2012
Location: Nagpur
Posts: 1
amolbhi_143 is on a distinguished road
Default Page Controle

PageControlDemo.h

@interface PageControlDemo : UIViewController<UIScrollViewDelegate>
{

UIPageControl *pageControl;

UIScrollView *scroller;
}

@property (nonatomic,retain)IBOutlet UIPageControl *pageControl;

@property (nonatomic,retain)IBOutlet UIScrollView *scroller;

-(IBAction)clickPageControlid)sender;

@end

PageControlDemo.m

@implementation PageControlDemo
@synthesize pageControl,scroller;

-(IBAction)clickPageControlid)sender
{
int page=pageControl.currentPage;
CGRect frame=scroller.frame;
frame.origin.x=frame.size.width=page;
frame.origin.y=0;
[scroller scrollRectToVisible:frame animated:YES];
}

-(void)scrollViewDidEndDeceleratingUIScrollView *)scrollView
{
int page = scrollView.contentOffset.x/scrollView.frame.size.width;
pageControl.currentPage=page;


}

- (void)viewDidLoad
{
[super viewDidLoad];
for (int i=1; i<10; i++)
{
UIImageView *images=[[UIImageView alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i]]];
images.frame=CGRectMake((i-1)*320, 0, 320, 460);
[scroller addSubview:images];
[images release];

}

scroller.delegate=self;
scroller.contentSize=CGSizeMake(320*9, 460);
scroller.pagingEnabled=YES;
pageControl.numberOfPages=9;
pageControl.currentPage=0;

}
amolbhi_143 is offline   Reply With Quote
Old 02-14-2012, 06:46 AM   #4 (permalink)
Use [code] tags please
 
Join Date: Jun 2009
Location: Jacksonville, FL
Posts: 410
timle8n1 is on a distinguished road
Default

Since you asked I decided to explain why I think this is not a good question.

1. It shows no level of effort. You have "no idea", really so you haven't even googled "iOS page control tutorial" or something?

2. Because of 1 it's not specific enough. Good questions post code and say I've tried this and it doesn't do what I want. How can I do X?

A good version of this question (IMHO), would go something like this.

I'm trying to use a page control. I found this tutorial (link) and tried it out. I got it working but now I want to have it scroll through ten images. I modified as such (post code in code tags). However now when I run it, it crashes and the error message is (specific error message with the line it crashed on - that should be identified in your posted code).

Just my humble opinion.
timle8n1 is offline   Reply With Quote
Old 02-23-2012, 07:54 AM   #5 (permalink)
Registered Member
 
Join Date: Feb 2012
Posts: 4
aegluc is on a distinguished road
Default

Hey is there any way to do this without using code generated pages? How Can I link this to views generated in the storyboard ? (instead of the array of images)
aegluc is offline   Reply With Quote
Reply

Bookmarks

Tags
images, iphone & ipod touch apps, page control

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: 345
5 members and 340 guests
bignoggins, Chickenrig, givensur, linkmx, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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