Splitting a view controller horizontally - objective-c

i want to split a view controller in 2 parts horizontally maintaining an aspect ratio.
Is there any way to this?

you can take reference from MGSplitViewController which can be replaced with SplitViewController. I hope you will get an idea about it.

Related

NSTableView section banner column with custom height

I am trying to create the following layout with a NSTableView:
A big banner per section on the side and regular text content rows on the right side.
The Image on the left side is the problem. It should behave like a floating section when scrolling (stay below the section header). It seems impossible to have the view part of the NSTableView as each column of a row needs to have the same height.
I already tried a lot of things, but I need some input which is the right direction.
What I tried:
Add the image view as a floating view into the NSScrollView? That seems like a good approach, but it doesn't stick on top while scrolling and the (re)positioning within the table is... tricky. Any hints here?
Add the view into the section header and disable clipping somehow (to make them larger than the section)? Couldn't make that work.
Having a table with NSStackViews per row that host itself tables - that did work, but: Independent selections per table is not what I want.
Ok, I finally found a solution.
The view is added to the floating view container of the NSScrollView that holds the NSTableView. I use the bounds of the row views and translate that to coordinates of the floating view container.
I also modified the selection drawing to make it look good and recalculate the coordinates on animations.

Retain positions after pasting UIImageViews in new UIScrollView

I made a prototype for an app, just as a proof of concept to test whether the functionality is working properly or not. Now that I am satisfied with the working functionality, I want to paste the images I placed in a UIView into a UIScrollView, so that I can show data in different pages. But, as I select the elements and paste it in a scrollview, all the positions are lost, and I have to manually place the elements in the interface builder.
Check out this image, I have these many elements that I need to paste inside the UIScrollView.
Is there a better way of doing this? or do I have to manually place the elements in positions I want?
Thanks!
If you want to avoid the headache of repostioning of controls in IB, then try the following option
1) Take one more UIView.
2) Add the UIScrollView into the UIView.
3) Add your current UIView(view which you shown in question) into the UIScrollView.
Thanks.
Select all your children, then Menu/editor/embed in scroll view.
Et voilĂ  !

How to draw in code an imageview

I have a problem. I want for each record in my core data database to draw an UIImage view on screen. But the problem is that I want to make a sort of grid. On the link below you see what I want to achieve.
picture
So my question is, how do I draw an image on screen in code. And place those images in a sort of a grid. using a collection view is no option, because the app should be running on all IOS devices.
While you could implement a custom UIView and implement the drawRect: method and draw UIImages there, I suggest just using multiple UIImageViews as subviews on your "main" view. Your view might be embedded in a UIScrollView, or you could use a UITableView with custom UITableViewCells. Whichever is easier is probably related to how you can interact with the view.
Building that one huge image view is something that I'd definitely try to avoid - it costs many many (probably unnecessary) memory, and it might be slow as well. Definitely not very flexible to handle, and a pain to update dynamically.
A quick cheat for something like this is to use a Table View and then in each cell to place another TableView but rotated at 90 degrees.
You can then use this second TableView to display the pictures etc...
This will give you a table that scrolls up and down and then each cell can scroll left to right.
I'd suggest subclassing UITableViewCell and setting it up as a UITableViewDelegate and UITableViewDatasource.
You will also have to remember to rotate the content of these "sub"tables by 90 degrees also so that they are the right way up.
This sounds like a lot of work but if you push the management of the sub Tables into the cells then it actually becomes quite easy.

Customising UITableView scrolling!

Is it possible to make the table view allow scrolling only in one section and not others OR in other words allowing scrolling only in desired sections of the grouped table?
Many thanks.
Sure, this is entirely possible if you're willing to forego the use of a tableview. If you use a scrollview, you can achieve what you want by defining custom behaviour. It's not going to be easy but here are some suggestions:
Figure out how you want it laid out on the screen
Create a "floating cell" that will hang around, this will be your "not scrolling" section
With respect to #2 above, you'll have to figure out what kind of logic you want to make that floating cell disappear versus the other data.
The rest, you're effectively reimplementing a tableview.
Now, you can probably achieve this with a tableview, but it's be hairy big time.

Graying out an NSWindow's content

I have an NSWindow with 2 NSViews (an NSSplitView and a custom NSView). Accessing the data to populate these views can take some time. During this period, I'd like to gray out the content of these views.
My first approach was to have a black third NSView that covered the other 2 and achieve the graying out effect by changing its alpha value. However I've since learned having a hierarchy with sibling views is undefined.
What is the best approach here?
Cache the NSBitmapImageRep of the 2 views, then replace them with the 3rd view, using the cached image(s) as background
Set the alpha value for each view separately (still not quite sure how to get the black background for the graying effect)
Something I haven't considered
I'd use a child window. Set its content view to a plain black view (hopefully with status and progress information in subviews), and its alpha value to the desired fade-out, and add it as a child window of the window whose content you want to fade out.
I'd teach the views how to draw themselves in a disabled state, but there are other suggestions here:
How can I darken everything displayed in a single NSView?