From past few days i have been trying to achieve scrolling of a background image using storyboard, but couldn't achieve it. If anyone can help me out that is much appreciable. I am attaching a snapshot of my storyboard along with this question if i need to do anything more for your clear understanding please let me know
Try to increase your content size of UIScrollView and also set the background image having equal size of width and height to ur UIScrollView.
Related
Currently, I have a UIButton and want to set an image inside of it. I'm successfully able to set the image to inside the UIButton but for some reason, the image is VERY small compared to the UIButton. I want to increase the size of the image - no, not cover the entire button just a slight increase so it's a bit more visible on the UI.
More information, my UIButton is 40x40. The answers I've seen on StackOverFlow have indicated changing the Content Mode but even those answers have not helped. I'm a little stuck at this point so any expertise/advice would be highly appreciated!
Figured it out. I had to use image insets. This property allows to reposition the drawing rectangle for the button image. By setting values to the top, bottom, left, and right image insets we're creating a rectangle and thus, increasing the space for our image to be draw in.
I had actually seen this suggestion in other answers and had tried it but on IB, nothing seemed to change but I finally decided to test it on simulator and saw the affects.
This issue is really frustrating and getting me crazy.
I've read everything about AutoLayout and so on, but it happens all the time.
My interface has a view with an image view as background and a smaller subview on top of it (corresponding to a field in my image). I've tried everything but it looks like the subview does not scale accordingly with my image when switching through devices.
By the way, the IB preview does not show what i real get when running the iOS Simulator, is that normal?
Why? What do i do wrong? I'm not sure what else to try!
http://i58.tinypic.com/34xqtc6.png
EDIT: i cannot post images :(
I have setup a githubrepo regarding your case, kindly have a look
https://github.com/usamaiqbal83/TestingProject
Constraints for Background Image View:
Constraints for Front View
the most important thing to remember is ofcourse the constraint equation
FirstItem.Attribute1 = (SecondItem.Attribute2 * Multiplier) + Constant
Instead of subview use Container View.
sorry, if this might been asked before.
I am laying out a viewcontroller for a new app. It will include a photo (UIImageview) which fills the nearly all of the screen and it should include a scrollable UITextview which should fill the bottom right corner of the screen and including a description of the photo.
So i have two views over one space and i would like to give the Textview priority over the UIimage. Is there any other way then reducing "Alpha" of the UIImage to make the Textview visible ? Tinkered around with Conten Hugging Priority and Content Compression ... to no avail.
Any help would be appreciated
Thanks
The easiest way to make sure text is easily readable over any image, I suggest setting a background of color rgba(.2, .2, .2, .8) or something similar and then using a white font color.
Thanks everybody for trying to help me out... I have found the solution... It is perfectly ok to overlay Views in Interfacebuilder but then it is imperative to use a background color for the overlaying textview with reduced opacity.
I'm trying to implement a UICollectionView that contains UIWebviews in each cell. I've almost got it working but I am having this problem of not being able to resize the webviews to the cell's content size. Each webview size so far is 1024x704 (width x height) and is a html file. I have enabled scalesPageToFit to YES but all it's doing right now is resizing it to only fit in the upper left corner.
I've checked the frame size of the webview and the collectionviewcell size and i get 1024x704 programmatically even though what is actually appearing seems to be a lot smaller than that.
Any suggestions/help on why this is happening and what I can do to scale it correctly? If I need to supply more info let me know. Thanks
EDIT:
As shown below this is how the UICollectionView looks like on an iPad. The rectangle in the left is the UIWebView and I'm trying to scale it to fit the whole screen.
EDIT2: Just realized I screwed up on how I wrote my html file. Sorry about that guys! Problem solved itself.
Try this:
self.webView=[[UIWebView alloc]initWithFrame:self.bounds];
self.webView.contentMode=UIViewContentModeScaleAspectFit;
self.webView.scalesPageToFit=YES;
self.webView.autoresizingMask=(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
i'm trying to create a snapshot of a complete uiscrollview, all the content size, i have searched a lot, and i have found something here on SO, like this:
Getting a screenshot of a UIScrollView, including offscreen parts
i have tried it, but there is a problem, because in the screenshot some element for example some UIImageView are enlarged or stretch, or in a different position, i can't understand why, anyone can help me to create this snapshot?
I'm not sure, but I think that UIScrollView elements are created and updated when they appear to the user. If so, probably their frames are not ready to be displayed when not on the shown "window".
Try to rasterize the content of your UIScrollView.
yourLayer.shouldRasterize = YES;
This way eveything should be updated at one time.