Re: layout method not getting called on Content View
Re: layout method not getting called on Content View
- Subject: Re: layout method not getting called on Content View
- From: Dave <email@hidden>
- Date: Thu, 16 Apr 2015 16:41:47 +0100
>> ______________________
> The right thing to do is to sit down and learn auto layout. You'll be glad you did. It's not going away and it's not that hard once you get over the hump.
> The best coverage are the short books by Erica Sadun. 1st edition is really Mac OS despite the title. 2nd edition is really iOS focused.
> The API is almost identical between the two platforms.
> It may take a few days to get grounded and a little longer to get confident.
> It's just doing indirect frames on one level but much more rewarding than that.
I use auto-layout on all my other Windows and i know a bit about how it works, I could do with learning more which I will do at some stage, but right now I have a very simple task that I’m stumped how to implement and I have a deadline to get a demo working, I thought the most straight forward way to just get something working (there’s a lot of code behind it, but of course the people I am demoing it too are more interested in see the visual part). This part is more of a tool than a production app.
It might help if I explained a bit more what I am trying to do. Firstly I’m reading data from a file (in this case, but could be a URL). The data is organised as Items, I turn this data into a hierarchal dictionary structure with each item being represented by an InfoObject. One of the properties of the InfoObject is a FrameRect (this is computed using data from other items). The dictionary structure and the content of each item can be changed at any time. When a change occurs I want to update any corresponding frames in a Window.
The idea is there are a LOT of items and I only want to display a few of them. I specify which ones to actually update in the NIB file, e.g. if there is an Item in the Dictionary structure that matches this view, then update the View Frame with the Value of this item.
On the face of it, I thought the quickest way to achieve this would be to turn off Auto-Layout and set the rectangle directly.
So, my first question is, is this the case? If so how do I go about doing it? What settings do I need to change in IB and at what point in the processing should I get the frame.
If it’s not possible to do this, or it would be quicker to use Auto-Layout then of course I’ll use it. When I was given this task I put down two hours in order to apply to Frame Position and Size, this was based on not using Auto-Layout and setting the Frame myself, I hadn’t thought that it would not be possible to do this.
I don’t know if it’s just the way I think, but given this task, using auto-layout doesn’t seem appropriate. It’s really cool and and is great for “normal”” windows, but it doesn’t suit this task IMO. I thought that’s why there was a switch to turn it off, so that you can go back to basics if you want to. Is this not the case?
As it stands now, I have all the rest of the code working and it’s calculating the correct rectangle, I just need to apply it to the frame of the corresponding view.
Any advice on how to quickly achieve this would greatly appreciated, but it if means spending days reading documentation and experimenting just to set the frame of a view, then I may as well forget including this part in the demo and work on improving other parts of the application.
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden