Hello,
I am working on a simple timer toolbar app in swift for macOS and I am experiencing a visual bug.
Basically, I should be able to add any number of timers to the main screen and they should stack on top of each other. Once the space is filled up in the window, a scroll bar appears allowing you to scroll through all the timers. My issue is that when I add the timers, they do not show all the time. I have a hunch it is either some refresh issue or some spacing issue.
The blank screen looks like this:
The bug is visible here. Out of the 3 timers added only 2 show up with the empty space between the 2 timers being the location where the third timer should be:
The main scene is arranged like this:
Where the mainScreenView and the dynamicScrollView and the View are all set to 250px wide. The timer view itself is a separate view, but that is also 250 px wide.
The code that adds the timers to the window is as follows:
func updateList(){
let documentView = NSView(frame: CGRect(x:0,y:0,width:250,height:max(360, AppDelegate.timekeeperArray.count*60)))
documentView.autoresizesSubviews = true
documentView.canDrawConcurrently = true
var counter = 0
for var i in AppDelegate.timekeeperArray{
//let offset = CGFloat(counter * 50)
//let button = NSButton(frame: CGRect(x:0, y:offset, width:150, height:50 ))
dsvScrollView.contentView.addSubview(i.getPreview(index: counter))
counter += 1;
}
dsvScrollView.documentView = …