Changing how IKImageBrowserView indicates the drop position - objective-c

I can make a single row IKImageBrowserView by setting the
[imageBrowser setContentResizingMask:NSViewWidthSizable];
but in this case while i drag an image inside image browser to rearrange it, the drop place highlights with horizontal line(vertical line expected).
how can this be changed?
Many thanks.

There is no defined way to do what you want.
You may be better off writing your own custom view where you can control every detail of how things are drawn. In general, Apple's controls are "as-is" and unless they provide an explicit way to control behavior or mention that you can custom an object in some way, don't count on being able to do it easily (if at all).
I would also suggest heading to http://bugreport.apple.com and making the enhancement request - it would be best if you attached a sample application demonstrating the behavior.
EDIT: You could also try out the NSCollectionView to see if it might work for you.

Related

Implement "sticky" section headers when scrolling in iOS

This implementation is similar to a normal UITableView, but with one caveat that drasticly changes the complexity of the work in my opinion. The ask is that all section headers will be visible at all times, no matter how long the table is.
Explaining the exact UX is a little difficult, but if you follow the link below there is an interactive example of exactly what I would like to accomplish in native iOS:
http://slinky.iclanzan.com/
It is my understanding that utilizing the normal UITableView will not be enough to satisfy this case. Aside from using a mashup of multiple TableViews, ScrollViews, and/or CollectionViews, I was wondering if anyone knew of some existing libraries that already perform this implementation?
Or if anyone has any high level suggestions on how to accomplish this with custom code that would be appreciated as well (Not looking for someone to write this all out for me, just an idea would suffice).
Found a solution after working with some teammates on a POC. I'll at a high level explain the implementation.
We know that a tableview's header and footer will remain static while we scroll. Since we want our sections headers to "stick" to the bottom and top of the tableview, we mimic this by dynamically adding any section header views that would have been hidden to the tableview's own header or footer.
We do this by maintaining an array of section header views, and calculating in layoutSubviews when we need to change the tableview's header and footer.

Prevent NSOutlineView (or NSTableView) from redrawing on scroll

It seems that my view-based OutlineView try to re-render text every time user scrolling. I think that was because it tried to save memory by re-using rows that fall outside of visible rectangle, then re-render new data to those old views. How can I disable this? I'm willing to sacrifice memory to archive this so that I can get better scrolling performance. (I have tried with various optimize like layer or so, but no luck).
EDIT: There is another question with same purpose as mine here How to make NSTableView not reuse TableCellViews, but no answer yet :(
I think you are confused -- it doesn't re-render the text. The table only shows views for the visible area (caveat below), and pulls in new views as you scroll -- potentially re-using old views.
You provide the view. Use the delegate method viewForTableColumn:row: and return your own cached view for a given row.
But that isn't going to prevent drawing; the view will likely still get marked dirty and draw.
I don't think you are asking the right question. It sounds like you have a performance problem. To help you with that, we'd have to see samples or instrument traces.
Caveat: Responsive Scrolling will pull in views that are in the non visible area. See the AppKit release notes about this.
corbin

How to place items in a NSScrollView

When I try to place objects using the Interface Builder in Xcode into a NSScrollView, they appear fine until runtime in the application, where they do not appear at all for some reason. I want it to be so that I can place multiple buttons and labels in the view, and have the user be able to scroll down to see more.
Am I not meant to use NSScrollView for this purpose?
Is there another way to go about implementing it I am not aware of?
You need to check the where you added the UI objects.
You need to consider these :
Is your autolayout enabled?
Did you flipped the view?
Resizing mask is working good as per your requirement.
Am I not meant to use NSScrollView for this purpose?
No, you picked the correct control for the requirement. NSScrollView is indeed for same kind of use.

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.

NSTextView enclosing scroll view jumps on spacebar

I have an odd behavior with my app and I don't know where it comes from. I have implemented a NSScanner for a text view content that works very well. The scanner works in conjunction with the text storage to set attributes on the text storage string via text view delegate methods. However, each time I enter a space, the enclosing scroll view scrolls back to the top of the text view. Can anyone give me a hint where this comes from ?
Probably not much hassle for those more experienced than me, I found out the possible reason for this behavior (see above) so I post it here in case anyone will look for solutions for similar "problems". It seems that turning off "Non-contiguous layout" option in the XCode 4.x attributes inspector for the NSTextView in case will solve the problem. The documentation for NSLayoutManager provides more clues (under "Overview" section): "Noncontiguous layout is an optional layout manager behavior new in Mac OS X v10.5..."
Maybe somebody more experienced than me will provide more info on this and the reason of this behavior of the enclosing scroller view when non-contiguous option is checked (which is, by default).
I am stuck with the same problem and turning off "Non-contiguous layout" does solve the problem, but it gives rise to another problem which is that the NSTextView gets sluggish for 10k lines of text. A similar question has been answered differently but I wonder if it works. That solution also imposes some restrictions which may not be applicable to you though.