Easiest way to add scrolling to a mac application - objective-c

Is there an easy way to add scrolling to the contents of a NSwindow? as an example scrolling sideways on this window to reveal more space?

This is very easy using an NSScrollView. In Interface Builder just drag a scroll view into your window. Then you can embed whatever contents you want in the NSScrollView's view. In Interface Builder's Attributes Inspector of the scroll view you can set whether you want horizontal and/or vertical scroll bars.

Related

Swipe to see options in iPad

How can I implement swipe to see more options? There are lot of libraries that I could readily use, but they all are designed for iPhone apps. In iPad you have a lot of space, and I want to stack the buttons vertically instead of horizontally.
Is there any library for this? If not, how should I go about building this as a custom cell?
I tried building a custom UITableViewCell class which adds a UIScrollView, but it's not the same as showing the buttons beneath the cell.
Based on your inputs I have created a simple custom cell with basic functionality of swipe to see utility buttons and of course buttons stacked vertically.
What I did was, add a UIView beneath the cell's content view and positioned at right. Now depending on the number of buttons provided each button's height is adjusted accordingly. And delegates are provided for button clicks.
Swipe gestures are added. On swiping left it will animate and shift the cell's content view to reveal the button view. On swiping right it will reset the cell to original position.
You can customise it from here onwards as you wish :)
I have uploaded them over here : https://github.com/srikanth-vm/GSSwipeableCell

Can't seem to achieve the same effect on my slide menu as Any.Do

I am trying to create the same type of slide-up/pull-up menu (from the bottom) as the Any.do iPhone app, but not having any success.
The issue I am running into is the app was built with storyboards so I am thinking I might have to scratch that idea and use just code.
Any ideas?
There is no need to get rid of your storyboard to recreate this, that's what IBOutlets are for. Any way, it looks like this was made by creating a UIScrollView that takes up the entire screen. Then add a UITableView to the upper section of the scroll view. Mind you in order for this to work, you'll need to disable scrolling on the scroll view in the background.
From there you can programmatically add the other elements to the scroll view to be rendered off screen, since there are only three they can probably just be buttons. And finally, since scrolling is disabled on the background scroll view you can add an image with a UISwipeGestureRecognizer at the bottom of the screen to manually change the scroll view's content offset property.

Could the view to be pushed up when the keyboard occur?

I have created some textfields at the bottom that required users to entry. Is there any method that can push up the view automatically when the keyboard occur?
See Apple's Moving Content That Is Located Under the Keyboard, or this implementation based in Calculating Area Covered by Keyboard.
Basically you have to mount your view on a UIScrollView and add a bottom content inset with the same height than the keyboard. Then scroll using setContentOffset:animated:. This is a generic solution that you can reuse.
A more simple but non generic way is, if you have enough space at the bottom of your view without editable controls, you just scroll to a fixed position for each edit box.
use the -contentoffset property of your view.

Paging Horizontally with vertical scroll on each page!

In my app I use a page control and a UIScrollView to page horizontally, I'd like to be able to enable vertical scrolling on each page. Now I know you can nest UIScrollViews in order to achieve this, there is however one problem in my project. Each of the pages uses a view controller consisting of a view, with a background image (different image for each page). This background image should not move while scrolling up and down.
Now what I want is the ability to have buttons, regular rect buttons, which I create in Interface Builder (since I want to be able to design and update the positions easily) and which then can be scrolled vertically.
So it should be like this:
You see a screen with a page-control on the bottom, above it an image with buttons over it. When you scroll sideways, you go to another page, again with an image (another one) and with different buttons. Now whenever you scroll vertically on a page, the buttons should be scrollable (so I can have a LOT of buttons on 1 page), but the image should maintain it's position.
So I figured, I just add another scroll view on top of the view with the background image. This works fine since I now have my buttons hovering over the background image and I have a separate nib file for each page including the buttons. But when I do it like this, the scrollview with the buttons becomes un-scrollable vertically. I don't know why this is happening, so could anyone suggest me how to achieve the wanted result?
I'd be really really grateful!
Thanks,
Fabian

How to include other controls in a scrollbar?

I want to create a scrollview with a zooming control and a button next to the scrollbar. Sort of like the "tile window" button in XCode (top right corner of the editor), it should be in the same box that usually is used by the scrollbar only.
Do you have an idea of how to approach this?
I was thinking to use an NSScrollView and set the scrollbars to a custom subclass of NSScroller which includes the other widgets. What kinds of buttons use the same style as the scrollbar?
Subclass NSScrollView and override -tile. You'll add the subviews on -init... or nib awake (or some other convenient time) and lay out the controls manually in your overridden -tile method. If you call [super tile] first, then adjust the bottom or right scroll bar to make room for your custom control(s), your job will be a lot easier.