UIDropInteractionDelegate not being called - ios

I have a DropAreaViewController in my app. Inside this controller I run the following code:
- (void)viewDidLoad {
[super viewDidLoad];
UIDropInteraction *interaction = [[UIDropInteraction alloc] initWithDelegate:self];
[self.view addInteraction:interaction];
}
- (BOOL)dropInteraction:(UIDropInteraction *)dropInteraction canHandleSession:(nonnull id<UIDropSession>)session {
NSLog(#"canHandleSession called");
return true;
}
- (UIDropProposal *)dropInteraction:(UIDropInteraction *)dropInteraction sessionDidUpdate:(nonnull id<UIDropSession>)session {
NSLog(#"sessionDidUpdate");
if (session.localDragSession != nil) {
NSLog(#"is localDragSession");
return [[UITableViewDropProposal alloc] initWithDropOperation:UIDropOperationMove intent:UITableViewDropIntentInsertAtDestinationIndexPath];
} else {
return [[UITableViewDropProposal alloc] initWithDropOperation:UIDropOperationCancel];
}
}
- (void)dropInteraction:(UIDropInteraction *)interaction performDrop:(id<UIDropSession>)session {
self.view.backgroundColor = [UIColor redColor];
}
Now, in another viewcontroller I add this controller:
DropAreaViewController *davc = [[DropAreaViewController alloc] init];
davc.view.frame = CGRectMake(0, 0, 100, 100);
[self.view addSubview:davc.view];
None of the drops are being registered though. I get not logs at all when I hover a drop on top of the square. Any ideas?

Related

UIView not Showing in Main View Controller

Hi all I'm implementing in my main ViewController some UIView custom class .. All are shown but only the KPHomeInfluenceUser is not visible .. Definitely it is a stupid question or lack of attention but you can explain why you do not see it ?? What am I doing is a wrong way to implement UIView Custom Class? If my method is wrong you can describe the correct method? I've seen many programmers implement classes this way.... Excuse me for stupid question
- (void)viewDidLoad {
[super viewDidLoad];
[self scrollView];
}
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.calendar clearAllDataToHomeCalendarAndReloadData];
[self.calendar scrollHomeCalendarToCurrentDayAndMonth];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
-(UIScrollView *)scrollView {
if (!_scrollView) {
_scrollView = [[UIScrollView alloc] init];
_scrollView.backgroundColor = [UIColor clearColor];
_scrollView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.scrollView];
[self.scrollView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = YES;
[self.scrollView.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor].active = YES;
[self.scrollView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor].active = YES;
[self.scrollView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor].active = YES;
[self calendar];
[self influenceUser];
[self homeBottom];
}
return _scrollView;
}
-(KPHomeCalendar *)calendar {
if (!_calendar) {
_calendar = [[KPHomeCalendar alloc] init];
_calendar.translatesAutoresizingMaskIntoConstraints = NO;
[self.scrollView addSubview:self.calendar];
[self.calendar.topAnchor constraintEqualToAnchor:self.baseUserPhoto.topAnchor constant:-5].active = YES;
[self.calendar.leftAnchor constraintEqualToAnchor:self.baseUserPhoto.rightAnchor constant:10].active = YES;
[self.calendar.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-10].active = YES;
[self.calendar.heightAnchor constraintEqualToConstant:85].active = YES;
}
return _calendar;
}
-(KPHomeInfluenceUser *)influenceUser {
KPHomeInfluenceUser *influence = [[KPHomeInfluenceUser alloc] init];
influence.translatesAutoresizingMaskIntoConstraints = NO;
[self.scrollView addSubview:influence];
[influence.topAnchor constraintEqualToAnchor:self.calendar.bottomAnchor constant:0].active = YES;
[influence.leftAnchor constraintEqualToAnchor:self.scrollView.leftAnchor constant:10].active = YES;
[influence.rightAnchor constraintEqualToAnchor:self.scrollView.rightAnchor constant:-10].active = YES;
[influence.heightAnchor constraintEqualToConstant:100].active = YES;
return influence;
}

VBPieChart - removeFromSuperView not working (hide chart)

I'm using VBPieChart, in Objective C language. I'm showing the chart on valueChange of a segmented control, like :
- (IBAction)segmentControlAction:(UISegmentedControl *)sender
{
switch ([sender selectedSegmentIndex])
{
case 0:
[self showPieChart:NO];
_tableViewForCount.hidden = NO;
[_tableViewForCount reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationRight];
break;
case 1:
_tableViewForCount.hidden = YES;
[self showPieChart:YES];
break;
default:
NSLog(#"None");
break;
}
}
and the showPieChart method goes like :
- (void) showPieChart:(Boolean)visible
{
VBPieChart *chart = [[VBPieChart alloc] initWithFrame:CGRectMake(0, 0, 250, 250)];
chart.center = self.view.center;
// Setup some options:
[chart setHoleRadiusPrecent:0.3]; /* hole inside of chart */
// Prepare your data
NSMutableArray *chartValues = [[NSMutableArray alloc]initWithObjects: #{#"name":#"Apples", #"value":#50, #"color":[UIColor redColor]},
#{#"name":#"Pears", #"value":#20, #"color":[UIColor blueColor]},
#{#"name":#"Oranges", #"value":#40, #"color":[UIColor orangeColor]},
#{#"name":#"Bananas", #"value":#70, #"color":[UIColor purpleColor]}, nil
];
if (visible)
{
chart.center = self.view.center;
// Present pie chart with animation
[chart setChartValues:chartValues animation:YES duration:0.4 options:VBPieChartAnimationFan];
[self.view addSubview:chart];
}
else
{
// remove chart
[chart removeFromSuperView];
}
}
Since VBPieChart is just a custom subclass of UIView, this should work. But i'm not getting any success.
I've also tried [chart setHidden:YES]; as well as [chart setAlpha:0.0]; , but still no luck.
Any help would is appreciated. I just want to hide/remove the chart when user switched back to segment index 0.
Thanks.
VBPieChart *chart create this object on the .h file then
- (void) showPieChart:(Boolean)visible
{
if(chart == nil)
{
chart = [[VBPieChart alloc] initWithFrame:CGRectMake(0, 0, 250, 250)];
[self.view addSubview:chart];
}
chart.center = self.view.center;
// Setup some options:
[chart setHoleRadiusPrecent:0.3]; /* hole inside of chart */
// Prepare your data
NSMutableArray *chartValues = [[NSMutableArray alloc]initWithObjects: #{#"name":#"Apples", #"value":#50, #"color":[UIColor redColor]},
#{#"name":#"Pears", #"value":#20, #"color":[UIColor blueColor]},
#{#"name":#"Oranges", #"value":#40, #"color":[UIColor orangeColor]},
#{#"name":#"Bananas", #"value":#70, #"color":[UIColor purpleColor]}, nil
];
if (visible)
{
chart.center = self.view.center;
// Present pie chart with animation
[chart setChartValues:chartValues animation:YES duration:0.4 options:VBPieChartAnimationFan];
chart.alpa = 1.0
}
else
{
// remove chart
chart.alpa = 0.0
}
}
You need to create variable as below.
static VBPieChart *chart = nil
if(!chart)
chart = [[VBPieChart alloc] initWithFrame:CGRectMake(0, 0, 250, 250)];
}
if (visible)
{
chart.hidden = NO;
}
else
{
// hide chart
chart.hidden = YES;
}

UIView strange behaviour with BOOL

I've made my custom UIView that I'm representing on UIViewController. View is presented on screen, but BOOL that I've setted on that instance of UIView to YES is not recognized.
Code:
UIView implementation:
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
[self createInterface];
}
return self;
}
-(void)createInterface
{
if (self.isSplash == YES) {
self.backgroundColor = [UIColor clearColor];
}
else {
self.backgroundColor = DARK_BLUE;
[self setupTimer];
}
....
ViewController:
self.sponsorView = [[SponsorMechanismView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.logo.frame)+10, SCREEN_WIDTH, 100)];
self.sponsorView.isSplash = YES;
[self.view addSubview:self.sponsorView];
So, I set BOOL to YES, but in this UIView it is always NO.
As Fabio said, createInterface has already been executed.
What you can do is create your own init function. Something like this :
- (id)initWithFrame:(CGRect)frame isSplash(BOOL)isSplash
{
self = [super initWithFrame:frame];
self.isSplash = isSplash;
if (self) {
[self createInterface];
}
return self;
}
And the call of the function will be like :
self.sponsorView = [[SponsorMechanismView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.logo.frame)+10, SCREEN_WIDTH, 100) isSplash:YES];
- (id)initWithFrame:(CGRect)frame AndIsFlash:(BOOL)isFlash{
self = [super initWithFrame:frame];
if (self) {
[self createInterfaceAndisFlash:isFlash];
}
return self;
}
-(void)createInterfaceAndisFlash:(BOOL)isFlash
{
if (isFlash == YES) {
self.backgroundColor = [UIColor clearColor];
}
else {
self.backgroundColor = [UIColor blueColor];
}
}
Hope you Got an Idea.
As mentioned in the comments:
The creatInterface method has already been executed when you set isSplash.
You can solve this by overwriting the setter of isSplash and calling createInterface there.
Code example here:
- (void)setIsSplash:(BOOL)isSplash
{
if (isSplash != _isSplash)
{
_isSplash = isSplash;
[self createInterface];
}
}

Creating a receipt style UIView

I am attempting to create a view to show a list of items and prices using two UILabels in a UIView.
In my UIViewController I call my subview LineItemView and pass data, and return the UIView to the main view that will hold the subviews.
Though my view is returning empty. The strings are null.
ViewController.m
#import "LineItemView.h"
//...
#property (weak, nonatomic) IBOutlet UIView *viewCharges;
//...
- (void)viewDidLoad {
[super viewDidLoad];
[self loadData];
}
- (void) loadData {
//Here we will fill in the viewCharges view
LineItemView * view = [[LineItemView alloc]init];
view.linePrice = #"1.00";
view.lineItem = #"Something";
[self.viewCharges addSubview:view];
}
LineItemView.h
#interface LineItemView : UIView {
UILabel * lblLineItem, *lblLinePrice;
}
#property (nonatomic,strong) NSString* lineItem;
#property (nonatomic,strong) NSString* linePrice;
LineItemView.m
#define LABEL_MINIMUM_HEIGHT 32
#define VERTICAL_MARGIN 5
#define HORIZONTAL_MARGIN 10
#implementation LineItemView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self createUI];
[self updateData];
NSLog(#"\n\n\n Line Item: %# Price: %# \n\n\n", self.lineItem, self.linePrice);
}
return self;
}
-(void) createUI {
lblLineItem = [[UILabel alloc] initWithFrame:CGRectZero];
lblLineItem.backgroundColor = [UIColor greenColor];
[self addSubview:lblLineItem];
lblLinePrice = [[UILabel alloc] initWithFrame:CGRectZero];
lblLinePrice.backgroundColor = [UIColor yellowColor];
[self addSubview:lblLinePrice];
}
- (void) updateLayout {
lblLineItem.frame = CGRectMake(HORIZONTAL_MARGIN, VERTICAL_MARGIN, 300, 35);
lblLinePrice.frame = CGRectMake(lblLineItem.frame.origin.x + lblLineItem.frame.size.width + HORIZONTAL_MARGIN, VERTICAL_MARGIN, 80, 35);
}
- (void) updateData {
lblLineItem.text = self.lineItem;
lblLinePrice.text = [NSString stringWithFormat:#"%0.2f", [self.linePrice floatValue]];
}
- (void) layoutSubviews {
[super layoutSubviews];
[self updateLayout];
}
What am I doing wrong?
If I want to continue calling LineItemView, how do I ensure that it is added below the previous one and ensure the viewCharges size is readjusted to fit all the subviews?
Solution using setters:
#implementation LineItemView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self createUI];
}
return self;
}
-(void) createUI {
lblLineItem = [[UILabel alloc] initWithFrame:CGRectZero];
lblLineItem.backgroundColor = [UIColor greenColor];
[self addSubview:lblLineItem];
lblLinePrice = [[UILabel alloc] initWithFrame:CGRectZero];
lblLinePrice.backgroundColor = [UIColor yellowColor];
[self addSubview:lblLinePrice];
}
- (void) updateLayout {
lblLineItem.frame = CGRectMake(HORIZONTAL_MARGIN, VERTICAL_MARGIN, 300, 35);
lblLinePrice.frame = CGRectMake(lblLineItem.frame.origin.x + lblLineItem.frame.size.width + HORIZONTAL_MARGIN, VERTICAL_MARGIN, 80, 35);
}
- (void) layoutSubviews {
[super layoutSubviews];
[self updateLayout];
}
- (void)setLineItem:(NSSTring *)lineItem {
_lineItem = lineItem;
lblLineItem.text = self.lineItem;
}
- (void)setLinePrice:(NSNumber *)linePrice {
_linePrice = linePrice;
lblLinePrice.text = [NSString stringWithFormat:#"%0.2f", [self.linePrice floatValue]];
}

How to add pagecontrol for uiscroll view?

Hi im new for iphone application development.i wanna use page controller for my uiscroll view.In single view im using two scroll views and two page controls.i setted pagecontrol with following codings but only for two pages its working fine.but i wanna add more than two pages for a scroll view whic consist of static buttons.![enter image description here][1]
//
// newsampleViewController.m
// newsample
//
// Created by SmartJobDevelopers on 4/3/12.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "newsampleViewController.h"
#implementation newsampleViewController
#synthesize scr_anger;
#synthesize scr_sketch;
#synthesize pageControl;
#synthesize pageControl1;
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[self setupPage];
//[scr_anger setScrollEnabled:YES];
//[scr_anger setContentSize:CGSizeMake(1290,15)];
//[scr_sketch setScrollEnabled:YES];
//[scr_sketch setContentSize:CGSizeMake(1310,15)];
[super viewDidLoad];
}
-(IBAction)buttonPressed:(id)sender {
i_curtag=(int)[sender tag];
//NSLog(#"%d",i_curtag);
[self fn_btnOperation];
//[self opt:str_filename];
//NSLog(#"str_filename:%#",str_filename);
}
-(void)fn_btnOperation
{
if (i_curtag==1)
{
//str_filename=[NSString stringWithFormat:#"%d.png",i_curtag];
//NSLog(#"str_filename:%#",str_filename);
str_filename=#"1.png";
// NSLog(#"1.png");
}
else if(i_curtag==2)
{
str_filename=#"2.png";
//NSLog(#"2.png");
}
else if(i_curtag==3)
{
str_filename=#"3.png";
//NSLog(#"3.png");
}
else if(i_curtag==4)
{
str_filename=#"4.png";
// NSLog(#"4.png");
}
else if(i_curtag==5)
{
str_filename=#"5.png";
//NSLog(#"5.png");
}
else if(i_curtag==6)
{
str_filename=#"6.png";
//NSLog(#"6.png");
}
else if(i_curtag==7)
{
str_filename=#"7.png";
// NSLog(#"7.png");
}
else if(i_curtag==8)
{
str_filename=#"8.png";
//NSLog(#"8.png");
}
else if(i_curtag==9)
{
str_filename=#"9.png";
// NSLog(#"9.png");
}
else if(i_curtag==10)
{
str_filename=#"10.png";
// NSLog(#"10.png");
}
[self opt:str_filename];
}
-(id)opt:(NSString*)filename
{
//NSLog(#"filename:%#",filename);
str_filename=filename;
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:#""delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:#"Save Image" otherButtonTitles:#"Mail Image",nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery showInView:self.view];
[popupQuery release];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex1
{
if (buttonIndex1 == 0)
{
// NSLog(#"str_filename in actionsheet:%#",str_filename);
[self savesingleimage];
// NSLog(#"save");
}
else if (buttonIndex1 == 1)
{
//NSLog(#"str_filename in else:%#",str_filename);
[self fmail];
//NSLog(#"mail");
}
}
-(void)fmail
{
//NSLog(#"str_filename:%#",str_filename);
NSMutableString *emailBody = [[[NSMutableString alloc] initWithString:#"<html><body><p>"] retain];
[emailBody appendString:#"<b><u>EMOTIONAL ICONS</u></b><br><br>"];
[emailBody appendString:#"</p></body></html>"];
MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];
UIImage *icon1 = [UIImage imageNamed:str_filename];
NSData *imageData1 = UIImageJPEGRepresentation(icon1, 1);
[emailDialog addAttachmentData:imageData1 mimeType:#"image/jpg" fileName:str_filename];
emailDialog.mailComposeDelegate =self;
[emailDialog setSubject:#"Emotional Icons"];
[emailDialog setMessageBody:emailBody isHTML:YES];
[emailDialog.navigationBar setTintColor:[UIColor blackColor]];
[self presentModalViewController:emailDialog animated:YES];
[emailDialog release];
[emailBody release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Status:" message:#"" delegate:nil cancelButtonTitle:#"ok" otherButtonTitles:nil];
switch (result) {
case MFMailComposeResultCancelled:
alert.message = #"Message Canceled";
break;
case MFMailComposeResultSaved:
alert.message = #"Message Saved";
break;
case MFMailComposeResultSent:
alert.message = #"Message Sent";
break;
case MFMailComposeResultFailed:
alert.message = #"Message Failed";
break;
default:
alert.message = #"Message Not Sent";
break;
}
[self dismissModalViewControllerAnimated:YES];
[alert show];
[alert release];
}
-(void)savesingleimage{
// NSLog(#"str_filename in save: %#",str_filename);
UIImage *image1 = [UIImage imageNamed:str_filename];
UIImageWriteToSavedPhotosAlbum(image1, nil, nil, nil);
UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:#"Saved"
message:#"Image Saved into PhotoAlbum"
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 170, 50, 50)];
NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:str_filename]];
UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
[imageView setImage:bkgImg];
[bkgImg release];
[path release];
[successAlert addSubview:imageView];
[imageView release];
[successAlert show];
[successAlert release];
}
#pragma mark -
#pragma mark The Guts
- (void)setupPage
{
scr_anger.delegate = self;
scr_sketch.delegate =self;
//[self.scr_anger setBackgroundColor:[UIColor blackColor]];
[scr_anger setCanCancelContentTouches:NO];
[scr_sketch setCanCancelContentTouches:NO];
scr_anger.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scr_anger.clipsToBounds = YES;
scr_anger.scrollEnabled = YES;
scr_anger.pagingEnabled = YES;
scr_sketch.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scr_sketch.clipsToBounds = YES;
scr_sketch.scrollEnabled = YES;
scr_sketch.pagingEnabled = YES;
self.pageControl.numberOfPages = 2;
self.pageControl1.numberOfPages = 2;
[scr_anger setScrollEnabled:YES];
[scr_sketch setScrollEnabled:YES];
[scr_anger setContentSize:CGSizeMake(1290,15)];
[scr_sketch setContentSize:CGSizeMake(1940,15)];
}
#pragma mark -
#pragma mark UIScrollViewDelegate stuff
- (void)scrollViewDidScroll:(UIScrollView *)_scrollView
{
// NSLog(#"scrollview val=%d",_scrollView.tag);
i=_scrollView.tag;
// NSLog(#"i=%d",i);
if (_scrollView.tag==101) {
if (pageControlIsChangingPage) {
return;
}
/*
* We switch page at 50% across
*/
//scr_anger.frame = CGRectMake(0, 0, 320, 0);
CGFloat pageWidth =scr_anger.frame.size.width;
//NSLog(#"pagewidth=%f",pageWidth);
int page = floor((scr_anger.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
// NSLog(#"page=%d",page);
pageControl.currentPage = page;
}
else if(_scrollView.tag==102)
{
if (pageControlIsChangingPage) {
return;
}
/*
* We switch page at 50% across
*/
CGFloat pageWidth =scr_sketch.frame.size.width;
int page = floor((scr_sketch.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
pageControl1.currentPage = page;
NSLog(#"page=%d",page);
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)_scrollView
{
pageControlIsChangingPage = NO;
}
#pragma mark -
#pragma mark PageControl stuff
- (IBAction)changePage:(id)sender
{
/*
* Change the scroll view
*/
//NSLog(#"i=%d",i);
if (i==101) {
CGRect frame = scr_anger.frame;
//pageControl.frame = CGRectMake(0, 390, 320, 15);
frame.origin.x = frame.size.width * pageControl.currentPage;
frame.origin.y = 0;
[scr_anger scrollRectToVisible:frame animated:YES];
/*
* When the animated scrolling finishings, scrollViewDidEndDecelerating will turn this off
*/
pageControlIsChangingPage = YES;
}
else if(i==102)
{
CGRect frame1 = scr_sketch.frame;
frame1.origin.x = frame1.size.width * pageControl1.currentPage;
frame1.origin.y = 0;
[scr_sketch scrollRectToVisible:frame1 animated:YES];
pageControlIsChangingPage = YES;
}
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[scr_anger release];
[scr_sketch release];
[pageControl release];
[pageControl1 release];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
#end
This is a relly good tutorial about UIScrollView&IPageControl combination. But I my self look for a tutorail for more dynamic designs(like main page of ios applications-i increments-decrements automatically)
Here's a information : http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview.html
In your setupPage: method, You have a code to allow number of pages like this.
self.pageControl.numberOfPages = 2;
self.pageControl1.numberOfPages = 2;
If you want to increase a numberOfPages, then increase the numberOfPages in these lines.

Resources