Does "natural scrolling" system preference affect NSEvent.scrollingDeltaY?
BTW, I find that "natural scrolling" on my Sonoma (Mac mini m1) stops working; turning on/off has no effect when I scroll in Finder app.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I accidentally removed the Fixed Width preset item in the font panel (by dragging it out).
Is there any way to get it back?
I have a tableview with a column which has an inner tableview. I want to change height of the outer tableview to match the height of the inner tableview.
outerTableView.reloadData()
let range = outerTableView.rows(in: summaryTableView.superview!.visibleRect)
outerTableView.noteHeightOfRows(withIndexesChanged: IndexSet(integersIn: range.lowerBound..<range.upperBound))
The above code will cause an exception:
WARNING: NSTableView detected a rowView was requested from inside of the -heightOfRow delegate method. That is not supported!
(
0 CoreFoundation 0x000000019093eccc __exceptionPreprocess + 176
1 libobjc.A.dylib 0x0000000190426788 objc_exception_throw + 60
2 AppKit 0x000000019420be98 -[NSTableRowData _availableRowViewWhileUpdatingAtRow:] + 0
3 AppKit 0x000000019425a470 -[NSTableView viewAtColumn:row:makeIfNecessary:] + 32
I have an uncommon scenario here.
outer tableview
+--------------------------+
| column 1| inner tableview|
+--------------------------+
Now most often the out tableview has many rows and vertical scrollbar visible.
When user try to scroll vertically in the inner tableview but it has no vertical scrollbar (because it has only a few items), I want the scroll event sink into its parent view or better outer tableview, so that user does not have to move cursor to first column in outer tableview and scrolls.
Is this possible?
I am no expert at coordinate systems. I am kind of aware I can use its enclosingScrollView but don't know the details.
Any suggestions would be appreciated.
What unit does NSView.bounds/frame use? Pixel or point? How to convert between them?
I have a custom Objective-C ObjectCache class that utilized NSMutableDictionary to store named objects (specifically large NSImage objects).
The class has a maxItems property and clear method, which worked fine.
- (void)clear
{
@synchronized(_cache)
{
[_cache removeAllObjects];
}
}
But yesterday I received a customer feedback complaining one of my app consumes up to 24GB memory.
I verified that on my M1 Mac mini, and it's true. Even after calling clear method, memory usage shown in both Xcode debugger panel and Activity Monitor remains the same.
It did work before. Once I close a picture gallery window by calling clear method, memory usage dropped immediately as shown in Activity Monitor.
I suspect that this is a bug in ARM architecture. Does anyone else have same problem?
I tried many ways but it seems I just cannot get it working.
// AppDelegate
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
true // false does not work either
}
// MainWC
func windowShouldClose(_ sender: NSWindow) -> Bool {
print(#function)
if sender === NSApp.mainWindow {
print("is main window")
sender.setIsVisible(false)
return false
}
return true
}
Once I hide the main window (using setIsVisible or orderOut) the app quits; even if I return false from applicationShouldTerminateAfterLastWindowClosed, NSApp.mainWindow will become nil.
I calculate cell view's width in func tableView(_ tableView: NSTableView, sizeToFitWidthOfColumn column: Int). I have a need to resize the tableview's width to just match total width of all cell views' (without scrollbars).
But it seems changing tableview's width does not work:
tableView.bounds.size = CGSize(width: w, height: tableView.bounds.height)
I suspect that I should change its clipping view or enclosing scrollview, but don't have any idea on this.
Any help?
I use ProcessInfo.processInfo.environment["key"] to get test parameters, but all of a sudden I could not find the UI like below:
In the screenshot above, the 2 environment variables were actually what I entered for the unit test target. I don't have any idea why they were moved there!
Any similar problems?
I just want some experts on Swift to confirm that the following syntaxes are equivalent:
if a > b, c > d {
}
if a > b && c > d {
}
I consulted "The Swift Programming Lanugage (version 5.7)" but the book does not cover this issue. But I believe it's true because my tests show they are the same.
I remember long time ago I could click on a button in Xcode to launch a Web page to manage iCloud data. But now I cannot find the button.
I want to check if a given string matches a file pattern.
Does Swift have builtin support for filename globbing? Or is there any 3rd party packages for this?
I had a customer feedback about a "zero length data" error which was captured using an exception handler and displayed using NSAlert.
My app employs [NSURLSession dataTaskWithURL:] to download XML and image data.
But I got no idea what it is about. I assume it's related to NSData, but this error never happened before (for years).
Does anyone have any idea about the source of this error?
Is it possible that I bypass tableView.makeView so that I can create a NSTableCellView on the fly (based on some logics)?
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
if NSTableColumn.identifier.rawValue == "labelColumn" {
let myCellView = NSTableCellView()
myCellView.textField.strinValue = "label text"
return myCellView
} else {
let complexView = loadFromNib() // of NSTableCellView
// populate complexView
return complexView
}
}