Can anyone point me in a direction to start with the following:
I have five UIWebViews, each of which is correctly sizing to content, inside of a UIScrollView. The UIWebViews display text only and since they are correctly sized to content, do not allow scrolling. I calculate the position of each UIWebView based upon the position and height of the previous UIWebView.
This works fine when all five UIWebViews fit within the bounds of the UIScrollView but I am not sure
How to position them when they exceed the vertical bounds of the UIScrollView
How to get the UIScrollView to actually scroll the contents.
I am working with someone who would like the UIWebViews to be separate controls for subsequent handling - highlighting and some oother functionality.
Related
Im having trouble resizing content inside static cells to fit different iPhone screen sizes.
Looking at the image below you can see that the UIPickerView and Sign In UILabel both did not resize in width.
I've tried adding code to the ViewDidLoad like so
self.signUp.frame = CGRectMake(0,0,self.view.frame.size.width,self.signUp.frame.size.height);to programmatically adjust their sizes but nothing changed.
I also tried adding equal width constraints to make it match the UITableViewCell contentView width and that did nothing as well.
Same issues happens to all UILabels (Membership,Schedule,Method...) and UITextFields (Comments)
This is all occurring in a UITableViewController.
How can I get it to resize?
Apples freeform UIViewController and UITableView are externally useful in this circumstance.
If you design your app in the storyboard, before applying constraints make sure the UIViewController's size is freeform (big square that doesn't match any screen size).
Then add constrains.
When you run the app, the app will resize properly.
I am trying to initiate a scroll view in my UITextView and even though I seem to have selected the appropriate boxes, I can't seem to get the scrolling working. I have gone through multiple questions similar to this but none seem to have the answer.
I included an image of Xcode below:
Question 2: When I scroll down the majority of my text shows but the scrolling stops with two sentences or so left and I have to scroll down and hold it there to read. Any way I can fix this so it scrolls all the way to the bottom of the text?
Can you check the two boxes: Bounce Horizontally and Bounce Vertically and see what's happening? Sometimes your content are actually way bigger than your view, and they are touching a invisible outer box. If you can see they actually move, that means there is nothing wrong with touch or scroll, is just the view layout problem.
For the content issue, my guess is that the content size is not right, you can programmatically adjust it with textView.frame property, set it to a proper size, such as the frame of the window or the frame of the content, which are CGRect classes. Comment below to see if this can solve your second problem.
The text view will not scroll in storyboard, only the app. And the text view will scroll once the content in the text view exceeds the frame size.
If you're using iOS 7+, you can just turn on auto layout, pin each of the sides of the text view to the edge of its parent view, and it works fine without needing to do anything in code.
In my app I'm using a scrolling canvas composed of equally sized cells.
The number of rows is unlimited, but the number of columns is fixed to 13.
At anyone time, I have exactly 7 cells fitting the width of the view.
I wrote my own tiling UIScrollView and everything is fine and works fine except for one thing:
I want to enable "paging" on the cell boundary, not on the "page" boundary.
In other words I want the horizontal scrolling to move no more than "one cell at a time". This is a usability issue.
In a standard UIScrollView with pagingEnabled=YES, there is some inertia when moving from one page to the next, but then the page is defined as having the full width of the view. I want to define the notion of page as 1/7 of the view width, such that I get the same kind of inertia when moving the display from cells 1-7 to cells 2-8, to cells 3-9, etc...
How would I go about that?
I found this and this, but this a related but different problem.
"Try making your scrollview less than the size of the screen (width-wise), but uncheck the 'Clip Subviews' checkbox in IB."
More info here.
I would like to make a side-scrolling object that is only 200 pixels wide and 50 pixels tall. This side-scrolling object would contain five different objects that, when scrolled into the middle, act as if selected. How could I go about doing this?
I want sort of the same effect that the iPhone home screen has where it latches on to a page when you slide it. Instead of latching on to the pages though, I want it to latch on to my five different objects.
The side-scrolling behavior is achieved with a UIScrollView with pagingEnabled set to YES. Set the scroll view's width to the size of your pages. Your scroll view delegate can calculate which object is on screen by dividing contentOffset.x by the scroll view's width.
If you want to show several items on the screen at once but still page between the individual items--think of the way the iWork apps show multiple documents, for example--there are three steps involved:
Set the scroll view's width to the width of the objects, not the width of the screen.
Set the scroll view's clipsToBounds property to NO so it displays the objects that aren't within the scroll view's frame.
Subclass UIScrollView and override -pointInside:withEvent: to return YES if the point is within the area you want to respond to touches within. (For example, if you want to respond to touches within the entire width of the screen, just ignore x and make sure y is between the top and bottom of the view.) Use this subclass instead of a standard UIScrollView.
Couldn't find anything on the net about this and wondered if anyone on SO has a solution.
I have an NSView with several subviews that are centered by removing the left and right anchor points. When I resize my view, programatically or with the mouse, to a smaller width than the subviews: it pushes them off center. Has anyone come across this before and do you have a solution?
EDIT: I want to be able to resize my view to a zero width. The reason being, the view is actually part of a split view and I have hooked up a button to 'collapse' it. When it collapses all of the subviews are pushed off-center and aren't re-centered when the view is resized, effectively un-collapsing it.
I have solved my problem now and thought I would share incase anyone comes across this issue in the future.
No amount of playing with autosizing options or view layouts in Interface Builder seemed to stop my subviews from getting moved off center. I did manage to find this link here and from this page, the advice:
Springs and struts, as currently
implemented, are really no good for
anything but keeping either one or
both sides of a view "stuck" to the
nearest edge. Any sort of centering
behavior, division of gained/lost area
between multiple views, etc. has to be
done by hand.
Based on this I overrode my view's setFrame: method and manually laid out my subviews using their setFrame: method. This works great and gives me the results I'm looking for.
There is the same issue using NSSplitView, resizing here one Subview to be smaller than the Subview Subviews makes sense,e.g. having small charts in the upper subview, and an rss reader in the lower subview.
If you want to show only the rss reader in the lower subview, you can "hide" the upper subview, but after resizing the upper subview the NSImageView are not layed out the same as in the beginning. Check this nib/xCode Project and the following screenshot to see this behaviour.
Only workaroung is to override the resize function to stop getting smaller.