I downloaded the sample, added the following lines to the MyViewController.h.
Up vote 0 down vote favorite 1 share g+ share fb share tw.
I have problem with customizing each page using pagecontrol and UIScrollView. I'm customizing Page Control from Apple. Basically I would like to have each page different with text and image alternately on different page.
Page 1 will have all text, Page 2 will have just images, Page 3 will have all text and goes on. This is original code: // Set the label and background color when the view has finished loading. - (void)viewDidLoad { pageNumberLabel.
Text = NSString stringWithFormat:@"Page %d", pageNumber + 1; self.view. BackgroundColor = MyViewController pageControlColorWithIndex:pageNumber; } As you can see, this code shows only Page 1, Page 2 etc as you scroll right. I tried to put in this new code but that didn't make any difference.
There's no error. I know this is pretty simple code. I don't why it doesn't work.
I declare pageText as UILabel. // Set the label and background color when the view has finished loading. - (void)viewDidLoad { pageNumberLabel.
Text = NSString stringWithFormat:@"Page %d", pageNumber + 1; self.view. BackgroundColor = MyViewController pageControlColorWithIndex:pageNumber; if (pageNumber == 1) { pageText. Text = @"Text in page 1"; } if (pageNumber == 2) { pageText.
Text = @"Image in page 2"; } if (pageNumber == 3) { pageText. Text = @"Text in page 3"; } } I don't know why it doesn't work. Also if you have better way to do it, let me know.
Thanks. Iphone objective-c uiscrollview uipagecontrol link|improve this question asked Aug 20 '09 at 6:55viper151016 50% accept rate.
I downloaded the sample, added the following lines to the MyViewController. H IBOutlet UILabel *pageText; @property (nonatomic, retain) UILabel *pageText; In the MyViewController. M I added the @synthesize pageText; line and your viewDidLoad contents.
I opened the MyView. Xib/en file in interface builder and connected the new label. Compiled and ran and it worked for the most part.
Only thing that didn't seem right was that it was a page behind. So I rewrote it to just handle odd or even pages appropriately. - (void)viewDidLoad { pageNumberLabel.
Text = NSString stringWithFormat:@"Page %d", pageNumber + 1; self.view. BackgroundColor = MyViewController pageControlColorWithIndex:pageNumber; if (pageNumber % 2) { pageText. Text = NSString stringWithFormat:@"Image in page %d", pageNumber + 1; } else { pageText.
Text = NSString stringWithFormat:@"Text in page %d", pageNumber +1; } }.
Thanks man. I think I forgot to connect pageText to nib file. I did that and put your code - Works fine!
However though, how do you customize each page? Say, Page 1 - you put some texts Page 2 - you put an image (it's very helpful if you could give code to put image as well) Page 3 - you put some texts - but different texts. Page 4 - you put different images Also, when you put the new codes under if statement there, it overwrite the first line code of pageNumberLabel.
How do you have it separate between pageNumberLabel and pageText but on same page with different content of course? – viper15 Aug 20 '09 at 7:38 I got it. I created a UIlabel pointing to pageText, so separate it from pageNumberLabel.
I'm using if statement - works fine. Thanks dude! – viper15 Aug 20 '09 at 12:32.
This answer will have very little code, as I have no distinct example. You basically want to have some array of pages, which holds a view (or view controller) for each page. There is no necessity that each view/controller in the array be the same (though you should have it be all views or all view controllers, not both).
Once you have that, you can load something distinct depending on which page you're loading. Does that make sense?
That's right man. Can I just not use array and use string or image instead? If I use arrays, how can this be implemented if based on Page Control from Apple?
– viper15 Aug 20 '09 at 7:42.
Try to download this project from SVN repo. I've been unable to finish the documentation but check out IGUIScrollViewElements ... there is a short example for IGUIScrollViewImage and the code is quite similar ... I'll do my best to finish examples for the remaining ones asap ... code.google.com/p/iphone-guru-uilibrary.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.