Window doesn't render as expected, controls gets messed up - objective-c

I have a NSWindow with autolayout, There is one view based NSTableView with few controls like images and labels . Once in a while the window comes ugly, means all the constraints doesn't work, and the text fields, images just loose their places.
All the controls inside the tableView are seen in (0,0). But only for few rows, for other rows it work perfectly, however all rows contains same controls.
This is happening only for the first time specially in OSX 10.10 when installing from DMG, if I reopen the window again then every thing look OK, no overlapping of text and other controls.
Please help to understand the issue, or any suggestion to fix.

Related

UTextView autocomplete vs live suggestions iOS

If I turn the autocorrection ON, the words get autocompleted, as if I write "wor", I get "word" before I finish writing. I don't want this to happen because I might be writing "world" or any word different than the autocompleted one.
I set Correction off in the Interface Builder and this problem is solved.
The problem now is that I still need the suggestions that appear in a little popover below the incomplete words.
This two features might be different but I don't know how to activate the suggestions.
How can I solve this?
This can be solved with the use of tableview. Create a tableview with the width as of the width of the textfield and height as you like. Place it just below the textfield. Make it hidden initially. When the user starts typing, fetch the array of data that resembles to the typed text and if any exists then, unhide the table view. On the subsequent typing keep on reloading the tableview sections with animations. You should be accurate on hiding, unhiding and then reloading the data on the tableview. I have implemented such thing before. It is really easy and once you get started with it you find it easy.
In the UITextView TextViewDidChange I created a thread that changed the cursor position. This, off course happens after the text view changes. The change of the cursor position triggers the autocomplete without letting me even see that there had been a suggestion.

Extended NSTableView

I would like to make a table-view with expanding ability.
When you press a row, the row should expand to show options like delete, copy and so on.
I have found an example for iOS, but I didn't get it running on Mac OS X, because NSTableView and UITableView are very different.
http://www.cocoacontrols.com/platforms/ios/controls/kofiles
Has anyone another template?
Or maybe even get this example running on Mac OS X?
I don't have code to hand you but you can use a view-based NSTableView. Your prototype view can resize itself to include controls if it's selected. All that's a bit complex to condense into a reasonably brief answer but if you use a view-based table view and treat the prototype view like any other that would grow and show extra controls, then wire this behavior to the selection state, it should work.
Note: you will have to write some code for the expansion portion, to handle resizing it, showing the controls, and notifying the table view that one of its rows changed height. Lots of documentation and examples exist out there for each individual component of your problem. Post more specific questions as you run into roadblocks.

How does the Reeder Mac app animate lists when switching folders?

Initially I was under the impression that it uses the table row slideup/down animations while inserting/deleting new rows but I doubt if it's doing that as it does it so fluidly even with thousands of items in the list (otherwise it would take a lot of time for the deletions/insertions to work).
Am I right in my assumption that it's simply attaching a new instance of the News list at the bottom of the screen, shrinking the above one while the one at the bottom expands to fill up space?
UPDATE:
Please see this video of what I mean: http://dl.dropbox.com/u/4960327/ReederAnim.mov
I can not tell you exactly how Silvio Rizzi made this, but as you see in the playback, a list view is added behind the shown list view, and the front list view fades out (.alpha = 0.0;) while the list view behind it expands its height per row.
When you desicate it frame by frame it becomes quite clear what he does, and it is really not that advanced. But I have to admit, with the white "milky" polished interface, it looks quite neat.
In addition, you can see that while animating, the background list view only renders the top 7 entries (hopefully calculated by dividing the view height with the average height of the cells shown) making the list view quick to load. Then afterwards, he can load an extended array of cells once you start scrolling, or in a background thread starting once the animation is complete.

Lazy loading images in a UITableView that has a scroll index

I think this is a new spin on an old question, but I'm completely stuck here.
In my app, I have a UITableView with 650 cells, each with a custom 16x16 RGB icon. On most recent iOS devices, loading all of those icons into memory before displaying the table works totally fine, but on older hardware, I'd like to implement a lazy load system that only loads icons it needs.
I've implemented the Apple LazyTableImages example, (which uses a UIScrollView delegate to determine when the table stops moving to load the visible icons), but I've run into another snag.
My UITableView also has a section index display (ie the list of labels on the right hand side you can swipe up and down to scroll quickly), and the LazyTableImages example hasn't taken this into account.
If I scroll using the index, the images won't lazy-load. :(
As far as I can see, the scroll index doesn't actually have any delegate events it triggers.
So I'm wondering, has anyone else tried to implement lazy-loading on a table with a scroll index? Is there any way to track the index and find out if the user has interacted with it?
Thanks!
After buzzing around a few of my iOS developer buddies, I came up with a solution that worked well enough.
I set it up so that in addition to the icons being loaded from the UIScrollView delegates, an NSTimer object will periodically call a method that checks the currently visible table cells ([UITableView indexPathsForVisibleRows]) every .5 seconds, and loads any icons on the screen that haven't been loaded yet in a single separate thread.
I tried to make the solution as efficient as possible, so I made sure the timer was only active when the tableView was visible and stationary, and I liked it since it meant that every visible icon regardless was addressed.
One thing I discovered was that if the tableView was reloaded while the thread was looping through the visible cells (rare, but was possible), it would crash. The solution to this was to make sure each cell data source entry was retained while the icon was being loaded.

Core Animation causing partial Source List focus ring

I'm using a slightly modified ImageAndTextCell from one of Apple's tutorials in a custom NSOutlineView. For those unfamiliar with it, it's an NSTextFieldCell subclass that draws an image to the left of the cell's text.
I have a Source List like iTunes's, with group rows, and items beneath. While editing the cell's value, the focus ring only draws partially for the group's first two rows (see below). The top third of the focus ring draws in the first row, and the bottom third draws in the second row.
Subsequent rows draw fine (see the third row below), and they all have the same image. What could be causing this? (See Update 3 below. Core Animation is causing this behavior)
Update 1
I commented out virtually all custom code in ImageAndTextCell and it made no difference (Only init, dealloc, copyWithZone, and the image getter and setter remained).
Update 2
I commented virtually all code in the NSOutlineView subclass, and my delegate class, as well as keeping all code from Update 1 commented out - still strange results. The third row is no longer always perfect, but the portions of the focus rect drawn shifted as I removed various functions.
Also, the items I'm having problems with are in the second of my two outline groups. When renaming the only item in the first group, the focus rect was perfect every step of the way. Ironically, this is the one that can't be renamed during standard operation of my app.
Next I'll take a look at all of my settings in the NIB and see if something might be broken there.
Update 3
I was able to fix it by disabling Core Animation across the board for every view in my window. The question has now become: How do I re-enable Core Animation without making my focus rects look crappy?
Not having solved this before moving to Lion, I can now happily report that switching to a view-based NSOutlineView fixes this problem. Oddly, if you turn on layer-backing in IB for the outline view, it creates other problems. The interface still animates, however, after unchecking those boxes (and has support for far richer animations than the cell-based outline view).