firstly, i want add 3 subviews with textview, image also edittext ;
view1 ; image,
view 2 : text, image,
view 3 : text, label
i want to scroll with async or with swipe
i used image scroll but can't find subviews
thanks for sharing
You can use an UIScrollView, or an UIPageViewController. Both will work, but the custom scroll view may be a bit simpler.
Related
i have View with alpha .5 with equal height and width to screen . I have to implement scroll view behind that view, Could anyone tell me how to implement it ?
As of Swift 5:
You can set the ScrollView as a child of the View in the Storyboard editor. Simply drag the ScrollView inside the View. The tree should look like the following:
View
ScrollView
< ... >
The ScrollView should be scrollable.
I'm having trouble with UIScrollView and Constraints.
I want to display a FAQ inside my application. This will include several questions and answers, with various length. It won't change after launch, so I handle everything directly in the storyboard. However, it has to work on different iPhone screen size (from iPhone 5 to iPhone 6 Plus).
So what I'm trying to do is :
UIView
UIScrollView
UIView (FAQ1)
UILabel (Question 1)
UITextView (Answer 1)
UIView (FAQ2)
UILabel (Question 2)
UITextView (Answer 2)
...
Here is an example of what it looks like (color on purpose, to see at runtime) :
Now if I apply some constraints, I manage to get that :
However it is not scrollable and the text is out on the right side.
If I run the same thing on a smaller screen, I get that :
Which is scrollable this time (not more than what you see on the screenshot...) and the text is still out.
Is there anyone who could help me understanding how to use Constraints properly with an UIScrollView ?
If possible the text size has to shrink on small screens.
If it isn't, it should keep the same size but the UITextView will be scrollable too.
The best way to use scrollview and auto layout is to add a view inside the scrollview and pin all its edges to scroll view and equal widths to superview, Pin all edges of scrollview to superView
pin top, left , right and height of your label to your FAQ1 view.
pin top of your text view to label and left right and bottom to your FAQ1 view.
pin the height of your FAQ1 view, and left and right of your faq1 view to content view.
Follow step 1 to 3 for all your faq views.
Pin top of your faq1 view to top to top of content view
Pin the top of the next faq view to bottom of the previous faq view.
pin bottom of the last faq view to bottom of content view
when adding your faq1 view pin its top to top ,left and right to contentView's top left and right with necessary padding.
You can find the sample code here
Hope this solves your problem
I have a right hand panel area in my app that's a tall vertical custom view (let's call this the column view) that contains 2 tableviews. Each tableview does not scroll, and although they are embedded in the standard clipview and scrollview, the vertical height of the tableview is the same as the total number of rows it contains, and bounce is disabled. As the number of rows increases, the background column view increases in height and needs to scroll vertically. It's also embedded in a scrollview. This sounds more complicated than it is, here's a pic:
Scrolling of the background column view works fine as long as the mouse pointer is not inside the red boxes, i.e., over the tableviews. I want to be able to vertically scroll regardless of where the mouse is located within the column view. Any ideas?
Update: here's a mainstream example of where tableviews embedded in a scrollview work correctly, in Tweetbot (assuming those sections are tableviews)
If you want to have scroll view inside other one (red area). You need to disable inner scroll view scrollWheel action. You can achieve that by writing custom NSScrollView subclass, and adding following method :
- (void)scrollWheel:(NSEvent *)theEvent {
// If scroll is disabled, send action to next responder
if (self.scrollEnabled == NO) {
[self.nextResponder scrollWheel:theEvent];
}
else {
[super scrollWheel:theEvent];
}
}
But don't think you need to have scroll view inside other scroll view. Rather you could use one table view with 2 kinds of cells, one for 'section header' and other for 'cell'.
This way you have one table view with multiple sections - just like in iOS.
I am having problem when making a long scroll view with images. It will be difficult for users to scroll down for so long to get to that image or button. Is there any ways that i can create some buttons on the top of the scroll view, while pressing these buttons that can directly scroll down to the specific position that i want? (scroll down animated will be good)
Many thanks.
- (IBAction) yourBtnInScrollViewPressed : (id) sender
{
[yourScrollView scrollRectToVisible:CGRectMake(x, y, yourScrollView.frame.size.width, yourScrollView.frame.size.height) animated:YES];
}
I have seen a lot of programs had some buttons or images in the vertical or horizontal scrollview table header or bottom and click it to invloke some events, But I have searched interface builder library and not found some widget I can used , how these programs to implement it ? Thank you very much!
To add just above the vertical scroll bar, see -[NSTableView setCornerView:].
To add to the left of the horizontal scroll bar, you'll need to subclass NSScrollView and (in addition to creating/configuring/adding the auxiliary view of your choice) override -tile. You'd call [super tile], then adjust the horizontal scroller to make room, then position the auxiliary view to taste.