Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
I am brand new to iPhone development and am doing to best I can with the resources I find on Apples site and other tutorials around the web, but I am still pretty clueless. I am currently working on an app that uses a control bar to display two different views. I'm A OK with my second view, it is my first view in which I am using a UIScrollView to display static images that I inserted with IB that I am having my problems. The images are sized to where only vertical scrolling is required and no zoom is used. I have on my first view's nib, a scroll view inserted and sized to 320 x 411 to fit in above the tab bar, then I have a UIView inserted within the scroll view and sized to 320 x 2300. This UIView is where I inserted my static images in IB using UIImage. It runs ok in the simulator but with an error of "This view is clipped by its superview. Line location ArtView.xib:29". When I install it and run it on my phone, it just crashes. I am sure I am missing some fundamental concept, but I am trying to teach myself something completely new. I'm going to try and attach my classes and nibs and if anyone would care to help, it would be greatly appreciated. Thank you. If you need more information, please let me know.
There is a nominal limit of 1024 for h and w of UIViews. Views larger than that will incur undefined behavior.
Thanks for the info. Still its not at the root of my problem, after resizing equal to or smaller than 1024 I am still getting the "view is clipped by the superview". Just to fool around with it, I removed the UIView that I had added to UIScrollView and directly placed the images on the Scroll View in IB and I don't get the error anymore. Is is wrong to place UIImageViews directly on the UIScrollView in IB?
I think I figured out why just placing the UIImageViews on the ScrollView is bad, you can not add anything to the scroll view past what your screen height is capable of showing. So, back to the darn UIView clipping my other view problems. Anyone else have any suggestions?
Right. The clipping error from IB is telling you that the subview is larger than the superview.
I think what you're supposed to do in this case is paging. You're supposed to add and remove subviews as they become visible/invisible due to scrolling.
The scroll view is only as big as the screen but it has a kind of virtual canvas defined by its contentSize and contentOffset.
I don't know if there's example code that shows how to do this paging.
This is not correct, and in fact is backwards. UIImages can be any size that will fit in memory.
They can be, but you're better not using them for onscreen drawing (like feeding it to UIImageView). Check the Apple docs:
You should avoid creating UIImage objects that are greater than 1024 x 1024 in size. Besides the large amount of memory such an image would consume, you may run into problems when using the image as a texture in OpenGL ES or when drawing the image to a view or layer. This size restriction does not apply if you are performing code-based manipulations, such as resizing an image larger than 1024 x 1024 pixels by drawing it to a bitmap-backed graphics context. In fact, you may need to resize an image in this manner (or break it into several smaller images) in order to draw it to one of your views.
This is not correct, and in fact is backwards. UIImages can be any size that will fit in memory.
To clear my point, I'm talking about container views primarily here. That's how I implemented a 1:1 1600x1200 camera photo support in one of my apps, for example.
1024 x 1024 is recommended by Apple as a limit to the size of UIViews. In fact views larger than that may work. I can tell you that table view cells work with a height up to about 2000 and fail when larger than that.
The limit is actually in CALayer and doesn't affect UIImage.
1024 x 1024 is recommended by Apple as a limit to the size of UIViews. In fact views larger than that may work. I can tell you that table view cells work with a height up to about 2000 and fail when larger than that.
The limit is actually in CALayer and doesn't affect UIImage.
This is the example I have went off for setting up the UIScrollView, Atrexis Blog: iPhone - Interface Builder Tutorial, I feel it should work fine for displaying 10 images that are 280 x 179. I will try it again.
How do I get my UIView that is 320 x 2300 within a UIScrollView that is 320 x 411 to quit clipping. I thought my UIView would conform to the UIScrollView size. If I remove the UIView, I have no clipping problems, but limited canvas size of the UIScrollView, there doesn't seem to be anyway to make a UIScrollView 2300px high, place my images on it then resize it to 411px high.
How do I get my UIView that is 320 x 2300 within a UIScrollView that is 320 x 411 to quit clipping. I thought my UIView would conform to the UIScrollView size. If I remove the UIView, I have no clipping problems, but limited canvas size of the UIScrollView, there doesn't seem to be anyway to make a UIScrollView 2300px high, place my images on it then resize it to 411px high.
Add and remove scrollview subviews that aren't visible as contentOffset changes.
@objectivedays, look at the page control sample code project. It will give you the basic idea. It scrolls horizontally and shows the current page with the page control but you should be able to use the same idea to scroll vertically with your images.
Well, I deleted the nib that contained the UIScrollView and rebuilt it from scratch . As of now, it runs in the simulator with no errors, I have no idea what I did differently. I haven't had an opportunity to run it on the phone yet, keeping my fingers crossed. Thank you guys for your time.
PoweredFlight what did you mean by "Add and remove scrollview subviews that aren't visible as contentOffset changes."?
PoweredFlight what did you mean by "Add and remove scrollview subviews that aren't visible as contentOffset changes."?
He meant the same thing that I meant when I said:
I think what you're supposed to do in this case is paging. You're supposed to add and remove subviews as they become visible/invisible due to scrolling.
I downloaded the page control source and will work on implementing paging, it seems a little over my head right at this moment, might take me a bit to digest. Thanks.
Replies
There is a nominal limit of 1024 for h and w of UIViews. Views larger than that will incur undefined behavior.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeTube Bias App
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeTube Bias App
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI think what you're supposed to do in this case is paging. You're supposed to add and remove subviews as they become visible/invisible due to scrolling.
The scroll view is only as big as the screen but it has a kind of virtual canvas defined by its contentSize and contentOffset.
I don't know if there's example code that shows how to do this paging.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeYou should avoid creating UIImage objects that are greater than 1024 x 1024 in size. Besides the large amount of memory such an image would consume, you may run into problems when using the image as a texture in OpenGL ES or when drawing the image to a view or layer. This size restriction does not apply if you are performing code-based manipulations, such as resizing an image larger than 1024 x 1024 pixels by drawing it to a bitmap-backed graphics context. In fact, you may need to resize an image in this manner (or break it into several smaller images) in order to draw it to one of your views.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeOr the kind of views that do their own drawing.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome1024 x 1024 is recommended by Apple as a limit to the size of UIViews. In fact views larger than that may work. I can tell you that table view cells work with a height up to about 2000 and fail when larger than that.
The limit is actually in CALayer and doesn't affect UIImage.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeHow do I get my UIView that is 320 x 2300 within a UIScrollView that is 320 x 411 to quit clipping. I thought my UIView would conform to the UIScrollView size. If I remove the UIView, I have no clipping problems, but limited canvas size of the UIScrollView, there doesn't seem to be anyway to make a UIScrollView 2300px high, place my images on it then resize it to 411px high.
Tube Bias App
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomePoweredFlight what did you mean by "Add and remove scrollview subviews that aren't visible as contentOffset changes."?
Allen
Tube Bias App
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeTube Bias App
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome