I've been teaching myself Objective-C and I wanted to start creating projects that don't use ARC to become better at memory management and learn how it all works. I've been attempting to build and run applications, but I'm not really sure where to start as modern iOS development is used with Swift and memory management is handled.
Is there any way to create modern applications that use Objective-C, UIKit, and not use ARC?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hello!
I wanted to see if someone with more UIKit experience than me can help me out on guiding me in the right direction for conditionally adding and deleting a row in a UITableView.
What I Want to Accomplish
I have a tip slider with percentages (0% - 20%) with a custom option on the end. I'm wanting to, when the custom option is tapped, bring up a row immediately below there and have a UITextField. When another option, let's say 10%, is tapped, I want the text field row to go away.
Can someone explain to me how this would work? And if so, provide an example?
Thank you!
Hello! I'm adding VoiceOver support for my app, but I'm having an issue where my accessibility value is not being spoken. I have made a helper class that creates an NSString from a double and converts it to the user's region currency.
CurrencyFormatter.m
+ (NSString *) localizedCurrencyStringFromDouble: (double) value {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterCurrencyStyle;
formatter.locale = [NSLocale currentLocale];
NSString *currencyString = [formatter stringFromNumber: @(value)];
[formatter release];
return currencyString;
}
View Contoller
self.checkTotalLabel.accessibilityLabel = NSLocalizedString(@"Total Amount", @"Accessibility Label for Total");
self.checkTotalLabel.accessibilityValue = [CurrencyFormatter localizedCurrencyStringFromDouble: total];
I'm confused on whether the value should go into the accessibility label or not. When the currency is just USD and the language is English, it's a simple fix. But when the currency needs to be converted, I'm not sure where to go from here.
If anyone has any guidance, it would help me a lot!
Thank you!
Hello! I've been using Objective-C to write a single-view application and have been using AppDelegate for my window setup.
However, with the next release of iOS, I need to adopt SceneDelegate into my app for it to work.
I'm having trouble getting my main ViewController to show up when the app starts. It just shows up as a black screen.
I built this app entirely programmatically. When I go into my info.plist file, I have everything but the Storyboard setup since, obviously, I don't have one.
I've left my code below.
Thank you!
My current AppDelegate:
#import "ViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
#pragma mark - UISceneSession Configuration
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
// Create the configuration object
return [[UISceneConfiguration alloc] initWithName: @"Default" sessionRole: connectingSceneSession.role];
}
#pragma mark - Application Configuration
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
- (void) dealloc {
[super dealloc];
}
@end
My Current SceneDelegate:
#import "SceneDelegate.h"
#import "ViewController.h"
@interface SceneDelegate ()
@end
@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Ensure we have a UIWindowScene
if (![scene isKindOfClass:[UIWindowScene class]]) {
return;
}
UIWindowScene *windowScene = (UIWindowScene *)scene;
// Create and attach the window to the provided windowScene
self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
// Set up the root view controller
ViewController *homeViewController = [[[ViewController alloc] init] autorelease];
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController: homeViewController] autorelease];
// Present the window
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
}
@end
Hello!
I'm creating a settings page for my app and I want it to look as native as possible. I want to know if it's possible to add constraints that make the second label go to the bottom when the text size gets really large (see Picture1) instead of having to force it to be on the right (see Picture 2).
I've left my constraint code for this cell down below, too.
I'm still learning constraints and best practices, so if there's any feedback, I'd love to hear it. Thank you!
Picture 1
Picture 2
- (void) setConstraints {
[NSLayoutConstraint activateConstraints:@[
// Cell Title Label
[self.themeColorLabel.leadingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.leadingAnchor],
[self.themeColorLabel.trailingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.trailingAnchor],
[self.themeColorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor],
[self.themeColorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor],
// Selected Theme Color Label
[self.selectedColorLabel.trailingAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.trailingAnchor],
[self.selectedColorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor],
[self.selectedColorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor],
]];
}
Hello!
I was doing some accessibility testing for my app and found out that when the user switches the text size, all of the data in the text fields is reset, which causes major disruption.
I've tried looking for documentation, but all I've found is information on how to dynamically scale the UI for different text sizes, which I've already implemented.
My guess is that every time Dynamic Type registers a change, it redraws my UI instead of just updating it.
How can I make sure the data is not reset when the text size changes?