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 10-24-2010, 01:18 PM   #1 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 1
maria77 is on a distinguished road
Default Orientation scrollFrame size problems

Problem with orientation

Hi everybody,

I am new to sdk/objective-C and I'm having some trouble with an app.

When I have landscape-view-orientation my image doesn't fit to screen.
The image rotates and its ok but the screen size is remaining inside the initial scrollFrame size (320,460).

I am sure that is something very easy but I don't have the knowledge to find it

My code is:

.m file

#import "UITestViewController.h"


UIImageView *largeImageView;
UIImageView *smallImageView;

@implementation UITestViewController


- (void)noteOrientationChangedNSNotification *)aNotification {
[self setBackgroundForOrientation:[UIDevice currentDevice].orientation];
}


- (void)viewDidLoad {

[super viewDidLoad];

//---------

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(noteOrientationChanged
name:UIDeviceOrientationDidChangeNotification
object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

//---------

CGRect scrollFrame = CGRectMake(0,0,320,460);
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollFrame];
scrollView.minimumZoomScale = 0.3;
scrollView.maximumZoomScale = 1.0;
scrollView.delegate = self;


UIImage *bigImage = [UIImage imageNamed:@"imageTest.jpg"];
largeImageView = [[UIImageView alloc] initWithImage:bigImage];

//-------------

UIImageView * smallImageView = [[UIImageView alloc] initWithFrame:CGRectMake(1510, 896, 52, 43)];
[smallImageView setImage:[UIImage imageNamed:@"demo.png"]];


//-------------------------------------------------------

[scrollView addSubview:largeImageView];
[largeImageView addSubview:smallImageView];

scrollView.contentSize = largeImageView.frame.size;

[self.view addSubview:scrollView];
scrollView.showsVerticalScrollIndicator = NO;
scrollView.showsHorizontalScrollIndicator = NO;

[scrollView release];
}

scrollView.autoresizingMask = (UIViewAutoresizingFlexibleRightMargin
|
UIViewAutoresizingFlexibleLeftMargin
|
UIViewAutoresizingFlexibleTopMargin
|
UIViewAutoresizingFlexibleBottomMargin);

- (UIView *)viewForZoomingInScrollViewUIScrollView *)scrollView
{
return largeImageView;
}


- (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)dealloc {
[largeImageView release];

[super dealloc];
}

@end



Does anyone have any ideas?

Thank you for your time!
Maria

Last edited by maria77; 10-24-2010 at 05:13 PM.
maria77 is offline   Reply With Quote
Reply

Bookmarks

Tags
landscape, orientation, screen size, scroll issue, scrollframe

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: 322
13 members and 309 guests
7twenty7, chiataytuday, condor304, Desert Diva, Domele, dre, dreamdash3, mottdog, oceanlablight, palme2elie, Paul Slocum, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,659
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dreamdash3
Powered by vBadvanced CMPS v3.1.0

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