nstableview

NSButtonCell as Checkbox in a NSTableVIew don't get selected

微笑、不失礼 提交于 2019-12-07 06:09:04
问题 I have a NSTableVIew for multi-selection purposes with two columns, the first one with a NSButtonCell as checkbox and the other one as a title. The idea is to check the items to be added afterwords to an array. The problem is that the checkboxes don't change its state when I click them. I've tried to attach an IBAction but the sender to de action is the TableView but not the checkbox Any ideas (or link) about how to achieve this kind of functionality? 回答1: Going on the assumption you're using

How to add row-span in view-based NSTableView?

↘锁芯ラ 提交于 2019-12-07 05:00:56
问题 I'm trying to get a table layout as shown below working with view-based NSTableViews that have been introduced in Lion. There were multiple approaches described for cell-based NSTableViews, e.g. Mimic the artwork column, but these don't really apply for view based table views. The idea is that the table gets populated by an array of objects, in one (or more) column spanning rows indicating that objects share some data in common. numberOfRowsInTableView: returns to total number of items (19 in

How to set row height based on its content in table?

依然范特西╮ 提交于 2019-12-07 04:59:01
问题 Generally, table has a fixed row height but according to my requirements I need to set height of each row according to content within it. Can anyone suggest me some solution for it? Thanks, Miraaj 回答1: The table view delegate protocol has a tableView:heightOfRow that lets you set the height of each row in the table view. 回答2: Thanks all for your suggestions and help. This problem is now resolved using following code in tableView:heightOfRow: float colWidth = [[[tableView tableColumns]

Cocoa osx NSTableview change row highlight color

元气小坏坏 提交于 2019-12-07 03:46:17
问题 In my application I have a view based NSTableView with one column. The highlight color of the rows is set to regular (blue). I need to change that color to my custom color. In the interface builder I tried changing it but the only options are "None, regular and source list". I tried this post solution with no success: https://stackoverflow.com/a/9594543/3065901 I read that I have to use this delegate method but I dont know how to use this. - (NSTableRowView *)tableView:(NSTableView *

Mac OS X replacement for NSFetchedResultsController

风流意气都作罢 提交于 2019-12-06 22:41:42
问题 So I'm used to iOS development so I'm pretty happy with NSFetchedResultsController. However, this is not present in the Mac OS X environment. I know that I can use NSArrayController as a replacement. I might be using this class terribly wrong but it worked until now. I initialize the NSArrayController as follows: NSArrayController* newConversationsController = [NSArrayController new]; newConversationsController.managedObjectContext = context; newConversationsController.entityName = entityName

Disable scrolling in NSTableView

纵饮孤独 提交于 2019-12-06 20:41:49
问题 Is there a simple way to disable scrolling of an NSTableView. It seems there isn't any property on [myTableView enclosingScrollView] or [[myTableView enclosingScrollView] contentView] to disable it. 回答1: This works for me: subclass NSScrollView, setup and override via: - (id)initWithFrame:(NSRect)frameRect; // in case you generate the scroll view manually - (void)awakeFromNib; // in case you generate the scroll view via IB - (void)hideScrollers; // programmatically hide the scrollers, so it

Cocoa Bindings - NSTableView - Swapping Values

你说的曾经没有我的故事 提交于 2019-12-06 16:30:19
Is an NSValueTransform subclass a good choice for displaying Core Data attributes into UI views displaying: A number string like (0,1,2,3,etc) into a string such as (Pending, Completed, Frozen, In progress, etc) A number string like (0,1) into a app-based image (red.png if 0, green.png if 1) Here's what Core Data displays for the two attributes, timer and status: Here is what I want to be displayed instead, without changing the values in Core Data: If not to use NSValueTransformer, in what other way is this possible? I do not want to see the data permanently converted, only for the benefit of

View based NSTableView viewForTableColumn:row not called

拈花ヽ惹草 提交于 2019-12-06 13:09:09
I've got a View-based NSTableView which is configured in IB to be View based. Its column identifier is set, too. As are its dataSource and delegate set, to the same object, which claims to conform to both in the public header. I've verified these are set after the tableView awakes from its nib. As per the docs, I've implemented -numberOfSectionsInTableView: and it gets called and returns a non-zero number. However, -tableView:viewForTableColumn:row: , much to my chagrin, does not, and I can't figure out why not. Does anyone know why this might happen? I'm running on Mountain Lion and my

Differences between NSTableView and NSCollectionView

谁说胖子不能爱 提交于 2019-12-06 12:11:38
问题 I'm trying to decide which path to take for developing my Snow Leopard app. First, I should preface with the obvious differences: NSTableView can have multiple columns of data for representing different parts of the same "element" of data (a row) where NSCollectionView can display a grid of data as well, but every row+column combo is its own element. For my purposes, assume I'm dealing with a single column. As far as I can tell, NSCollectionView items are NSView s which all must be of the

NSScrollView detect scroll position

为君一笑 提交于 2019-12-06 11:45:50
问题 How can i detect scroll of position when the scroll at bottom? [[_scrollView contentView] setPostsBoundsChangedNotifications:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChangeNotification:) name:NSViewBoundsDidChangeNotification object:[_scrollView contentView]]; - (void) boundsDidChangeNotification: (NSNotification *) notification { NSPoint currentScrollPosition = [[_scrollView contentView] bounds].origin; } 回答1: Update : My original answer was