Search results for

“column”

2,085 results found

Post

Replies

Boosts

Views

Activity

Reply to Delete items in collection view with custom layout
I edited with <> to make it more readableimport UIKit class testVCViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, ImagesCVLayoutDelegate { @IBOutlet weak var cv: UICollectionView! @IBOutlet weak var btn: UIButton! @IBAction func btn(_ sender: UIButton) { items.remove(at: 0) cv.deleteItems(at: [IndexPath(row: 0, section: 0)]) // THIS IS WHERE THE WARNINGS AND ERROR OCCUR. cv.reloadData() } var items = [1,2,3,4,5,6,7,8,9] // Data source. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return items.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cell, for: indexPath) as! zCollectionViewCell cell.lbl.text = (items[indexPath.row]) return cell } func numberOfSections(in collectionView: UICollectionView) -> Int { return 1 } func co
Topic: Programming Languages SubTopic: Swift Tags:
May ’18
Reply to NSTableView not setting the content right
Actually, I was able to get the content displayed. Following guide was helpful although different then what is current working:https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/TableView/PopulatingView-TablesProgrammatically/PopulatingView-TablesProgrammatically.htmlI then had to match the identifier of the cell with the column.
Topic: UI Frameworks SubTopic: AppKit Tags:
Oct ’16
Reply to Checkbox in NSTableView
So I start off with a structure like so:Table ColumnTable Cell View Table View Cell Table View Cell Number FormatterText CellTable ColumnTable Cell View Table View Cell <=- I delete this one Table View CellText CellSo I then delete the one that I pointed at, which is the one I think you're telling me to, so it and the one child go away. Now I drag a check cell into that second column, and then suddenly stuff from other columns disappear as well, and I'm left with this:Table ColumnText CellTable ColumnCheckWhat did I do wrong?
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’16
Reply to Loosing precision of a number somewhere
I then use this value and insert it in a Local SQLite DB using the following commandWhat does your database schema look like? Specifically, what is the type of the price column? In general you don’t want to use REAL for currency values because the rules of floating point arithmetic can result in significant rounding errors. In situations like this it is better to store the number of cents in an INTEGER column (that is, fixed point arithmetic). Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Programming Languages SubTopic: General Tags:
Jun ’16
Reply to Illegal NSTableViewDataSource
I do get the hierarchy you outlined:View ScrollView ClipView TableView Column1 => That's the identifier you use (Where in the code I used this?) TableCellView => That's the identifier you have to use TableViewCell Column2Where did I use the Column identifier? Not sure.
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’20
Reply to NSTableView: dynamic columns
I can think of two possible reasons why this might happen:1. You subclass NSTableView to override makeView (withIdentifier:owner:), but you didn't actually cause an instance of the subclass to be created. Can you verify that your custom makeView method is actually executed?Note that the method is makeView, not make, but I assume that's just a typo in your post.2. You create a NSTableCellView, and you add a text field subview, but you have no code to position the text field within the cell, nor any code to set the size of the text view. If its size is zero, or it's positioned outside the parent view, the column will look empty.Your technique for creating these cells is not a good one. Instead, you should do the following:— Create a XIB file that contains a prototype NSTableCellView for the ligne24 column.— For the File's Owner pseudo-object in the XIB, specify the class of your NSTableViewDelegate object (e.g. a view controller class).— Set the cell view's identifier to ligne24.— Add a text v
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’17
Reply to With Swift, can Cocoa Bindings be used to sort by a column in NSTableView?
(It's a while since I had to sort a column, so forgive me if I misremember at any point.)>> I'm using bindings to populate the rows, and I wouldn't expect to set a table view delegate under those circumstancesYou almost always end up wanting a delegate for something or other, so it's usual to have one. But you don't need to do anything with tableView(_:sortDescriptorsDidChange:) in your scenario. The array controller will do the heavy lifting for you.>> do bindings just replace the dataSource … ?Yes, they do. If you use bindings, you don't need a data source (and it can be nil). However, for historical reasons, methods that deal with dragging rows are in the data source protocol, not the delegate protocol. If you need to support dragging, you will need to use a data source after all. In this case, you do not implement the data source methods that the documentation says you must implement. You just implement the ones you need to support dragging.>> I am already using an NSArrayContro
Feb ’18
Reply to This class is not key value coding-compliant error
I changed the code to the following: cellIdentifier = CellIdentifiers.LastUsedCell } if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: cellIdentifier), owner: nil) as? NSTableCellView { // cell.textField?.stringValue = text cell.textField?.stringValue = Test Field print(cell.textField?.stringValue) return cell With this change it tells me that the issue must be in IB for that column because again the only column that it crashes on is itemUsed. Do you agree? After reading your latest post I changed the code. So, here is how the code looks now with the added print statement along with changing owner to self along with print results from console: } else if currentColumn == fieldIdentifiers.LastUsed { print(LastUsed, CellIdentifiers.LastUsedCell) text = dateFormatter.string(from: currentItem.itemLastused!) cellIdentifier = CellIdentifiers.LastUsedCell } if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: cellIdentifier),
Nov ’20
Reply to Importing data via .csv file
Hi @Josedv I'm working on an app with csv read functionality (tapping on a button to open share extension and read a file from Files/...). I managed to find the following in some other thread, which works(ish) for me (I'll explain the ish). I totally agree with @eskimo that you should enforce some sort of formatting rule wherever csv files are generated (this was an ongoing pain at one of my previous jobs), and another pain was to verify the validity of the content, but I guess that's another conversation? It's available from https://github.com/ahltorp/csvparser I used it with Swift 5, and it reads my csv file properly. My csv file was generated using commas as delimiter, nested data as header/detail report style and column order as original. So the ish part, it generates an array of arrays of String ([[String]]), with the first item being the titles for each column (this is particularly useful because this determines the number of columns too, even if one of the rows in that column
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20
Reply to How to set TableColumn in Table using ForEach
This is a very essential question since it would give us the possibilities to show/hide table columns dynamically which is not possible another way. So I am asking the same. Can someone provide a complete working solution ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Delete items in collection view with custom layout
I edited with <> to make it more readableimport UIKit class testVCViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, ImagesCVLayoutDelegate { @IBOutlet weak var cv: UICollectionView! @IBOutlet weak var btn: UIButton! @IBAction func btn(_ sender: UIButton) { items.remove(at: 0) cv.deleteItems(at: [IndexPath(row: 0, section: 0)]) // THIS IS WHERE THE WARNINGS AND ERROR OCCUR. cv.reloadData() } var items = [1,2,3,4,5,6,7,8,9] // Data source. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return items.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cell, for: indexPath) as! zCollectionViewCell cell.lbl.text = (items[indexPath.row]) return cell } func numberOfSections(in collectionView: UICollectionView) -> Int { return 1 } func co
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’18
Reply to NSTableView not setting the content right
Actually, I was able to get the content displayed. Following guide was helpful although different then what is current working:https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/TableView/PopulatingView-TablesProgrammatically/PopulatingView-TablesProgrammatically.htmlI then had to match the identifier of the cell with the column.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Oct ’16
Reply to Populating a Table translate to Swift ?
As works fine thanks. :-)I seem to have a problem with the identifier not working. The result is always nil not sure why, I set up an ident for the column but the rest of the hierarchy items are default. Where is the ident being called from ?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Feb ’19
NSBrowser Dragging exception being thrown: 'Can not nest column dragging sessions'
Sometimes this is being thrown when dragging rows in NSBrowser. Don't know what's going on. When I googled this, I've seen some posts around from others, but none had an answer.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
0
Boosts
0
Views
199
Activity
Jul ’15
Reply to NavigationSplitView not working as shown in "What's new with SwiftUI" session
I found that appending an .id modifier to the detail column resolved the problem for me: } detail: { if let selectedCocktail { CocktailDetailView(pCocktail: selectedCocktail) .navigationTitle((selectedCocktail.favorite ? (profile.userData.favoriteCocktailsIcon.rawValue) : ) (selectedCocktail.cocktailName ?? )) .id(selectedCocktail.id) //workaround }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to Checkbox in NSTableView
So I start off with a structure like so:Table ColumnTable Cell View Table View Cell Table View Cell Number FormatterText CellTable ColumnTable Cell View Table View Cell <=- I delete this one Table View CellText CellSo I then delete the one that I pointed at, which is the one I think you're telling me to, so it and the one child go away. Now I drag a check cell into that second column, and then suddenly stuff from other columns disappear as well, and I'm left with this:Table ColumnText CellTable ColumnCheckWhat did I do wrong?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’16
Reply to Loosing precision of a number somewhere
I then use this value and insert it in a Local SQLite DB using the following commandWhat does your database schema look like? Specifically, what is the type of the price column? In general you don’t want to use REAL for currency values because the rules of floating point arithmetic can result in significant rounding errors. In situations like this it is better to store the number of cents in an INTEGER column (that is, fixed point arithmetic). Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’16
Reply to How to declare a TableColumn with nullable field?
One workaround would be to change my model to not have nullable fields, and set to when decoding a null. However, that to me, is a kludge. My model data is coming from a database table in Postgres where the column(s) are NULLABLE.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to How do I view sibling and ancestor constraints in Xcode 11?
Pretty straightforward, I think, in that children always inherit from parents.If you're asking for a tool/menu that allows you to visualize them, the left column in IB's editor is sorted on hierarchy, just be sure to toggle everything to show.
Replies
Boosts
Views
Activity
Oct ’19
Reply to Illegal NSTableViewDataSource
I do get the hierarchy you outlined:View ScrollView ClipView TableView Column1 => That's the identifier you use (Where in the code I used this?) TableCellView => That's the identifier you have to use TableViewCell Column2Where did I use the Column identifier? Not sure.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’20
Reply to NSTableView: dynamic columns
I can think of two possible reasons why this might happen:1. You subclass NSTableView to override makeView (withIdentifier:owner:), but you didn't actually cause an instance of the subclass to be created. Can you verify that your custom makeView method is actually executed?Note that the method is makeView, not make, but I assume that's just a typo in your post.2. You create a NSTableCellView, and you add a text field subview, but you have no code to position the text field within the cell, nor any code to set the size of the text view. If its size is zero, or it's positioned outside the parent view, the column will look empty.Your technique for creating these cells is not a good one. Instead, you should do the following:— Create a XIB file that contains a prototype NSTableCellView for the ligne24 column.— For the File's Owner pseudo-object in the XIB, specify the class of your NSTableViewDelegate object (e.g. a view controller class).— Set the cell view's identifier to ligne24.— Add a text v
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’17
Reply to With Swift, can Cocoa Bindings be used to sort by a column in NSTableView?
(It's a while since I had to sort a column, so forgive me if I misremember at any point.)>> I'm using bindings to populate the rows, and I wouldn't expect to set a table view delegate under those circumstancesYou almost always end up wanting a delegate for something or other, so it's usual to have one. But you don't need to do anything with tableView(_:sortDescriptorsDidChange:) in your scenario. The array controller will do the heavy lifting for you.>> do bindings just replace the dataSource … ?Yes, they do. If you use bindings, you don't need a data source (and it can be nil). However, for historical reasons, methods that deal with dragging rows are in the data source protocol, not the delegate protocol. If you need to support dragging, you will need to use a data source after all. In this case, you do not implement the data source methods that the documentation says you must implement. You just implement the ones you need to support dragging.>> I am already using an NSArrayContro
Replies
Boosts
Views
Activity
Feb ’18
Reply to This class is not key value coding-compliant error
I changed the code to the following: cellIdentifier = CellIdentifiers.LastUsedCell } if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: cellIdentifier), owner: nil) as? NSTableCellView { // cell.textField?.stringValue = text cell.textField?.stringValue = Test Field print(cell.textField?.stringValue) return cell With this change it tells me that the issue must be in IB for that column because again the only column that it crashes on is itemUsed. Do you agree? After reading your latest post I changed the code. So, here is how the code looks now with the added print statement along with changing owner to self along with print results from console: } else if currentColumn == fieldIdentifiers.LastUsed { print(LastUsed, CellIdentifiers.LastUsedCell) text = dateFormatter.string(from: currentItem.itemLastused!) cellIdentifier = CellIdentifiers.LastUsedCell } if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: cellIdentifier),
Replies
Boosts
Views
Activity
Nov ’20
Reply to Importing data via .csv file
Hi @Josedv I'm working on an app with csv read functionality (tapping on a button to open share extension and read a file from Files/...). I managed to find the following in some other thread, which works(ish) for me (I'll explain the ish). I totally agree with @eskimo that you should enforce some sort of formatting rule wherever csv files are generated (this was an ongoing pain at one of my previous jobs), and another pain was to verify the validity of the content, but I guess that's another conversation? It's available from https://github.com/ahltorp/csvparser I used it with Swift 5, and it reads my csv file properly. My csv file was generated using commas as delimiter, nested data as header/detail report style and column order as original. So the ish part, it generates an array of arrays of String ([[String]]), with the first item being the titles for each column (this is particularly useful because this determines the number of columns too, even if one of the rows in that column
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’20