Post

Replies

Boosts

Views

Activity

The interaction's view (or an ancestor) must have an associated view controller for presentation to work.
Still struggling with menus in iOS 13/14.... I tried to add a menu to the navigation bar.... and I am also getting the same error as the context menus... "The interaction's view (or an ancestor) must have an associated view controller for presentation to work." The UIWindow has a rootViewController...the stand-alone Navigation bar is a subview of the UIWindow... and I add the menu to the navigation bar with: UIBarButtonItem *options = [[UIBarButtonItem alloc] initWithImage:[UIImage systemImageNamed:@"list.bullet"] menu:[windowmenu menu]]; The entire application is generated programmatically, not using Interface Builder so maybe I am not hooking things up correctly, or need to add something I am missing. Do I need to connect the UIViewController to the UINavigationBar, UITableView etc somehow?
9
0
1.9k
May ’21
How do I enable/disable individual optimizations in Apple's Clang?
I work on a very large project based on Mozilla Firefox, I am getting a crash at -O2 and -O3. It is stable at -O0 and -O1, so I did some research and found a number of optimizations that supposedly get enabled at -O2. The information I found tells me that I should use -mllvm and the optimization flag that gets passed to the LLVM "opt" command in the normal LLVM toolchain. However Apple's command line tools do not have the "opt" command and -mllvm does not seem to accept the "opt" flags. What is the Apple way of seeing what optimizations are enabled in -O2 and how do I enable or disable them individually?
2
0
859
Apr ’22
Extending UITableViewCell with UIStackView in Objective-C
I have my own cross platform widget layout system that I use for most things so I have never had to use layout constraints before, so this is my first dive into it. My code is in Objective-C not Swift and all of the examples I find are sadly in Swift. By default my UITableView will only show an Icon and Text. However it has extra "column" icons and text that would be in individual columns on MacOS or other desktop platforms. I have a toggle that will allow this additional information to be displayed in an either horizontal or vertical UIStackView. So if toggled I want to add the UIStackView to the UITableViewCell placed under the textLabel expanding the UITableViewCell by whatever size the UIStackView requires. My thought was I could do this by adding 3 constraints connecting the UIStackView, contentView and textLabel together. This didn't produce the expected result. The first two constraints correctly position the UIStackView below the textLabel but did not expand the UITableViewCell. Adding the third (bottom) constraint to expand the cell, instead clips the UIStackView out of the cell entirely. Can someone point out what I am doing wrong? /* If we don't have a stack, create one */ NSLayoutConstraint *constraint; stack = [[[UIStackView alloc] init] retain]; [stack setTranslatesAutoresizingMaskIntoConstraints:NO]; [stack setSpacing:5.0]; [[self contentView] addSubview:stack]; /* Leading */ constraint = [NSLayoutConstraint constraintWithItem:stack attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self contentView] attribute:NSLayoutAttributeLeft multiplier: 1.0 constant:0.0]; [[self contentView] addConstraint:constraint]; /* Top */ constraint = [NSLayoutConstraint constraintWithItem:stack attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self textLabel] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]; [[self contentView] addConstraint:constraint]; /* Bottom */ constraint = [NSLayoutConstraint constraintWithItem:[self contentView] attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:stack attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]; [[self contentView] addConstraint:constraint];
0
0
458
Sep ’22