Post

Replies

Boosts

Views

Activity

Un-swipe tableview cell after action is selected?
I have a couple of actions in the leading and the trailing swipes of a table view cell. Like in the mail app, I want to unswipe the cell as soon as an action is selected. Notice how the 'Mark as read' blue colored action disappears when its selected. Any guesses how it can be done? Neerav
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
537
Feb ’24
How to design for 0hrs 0mins countdown timer as default (indicating timer not set).
In my app, its optional that a user sets a timer for a given thing. For that, I wanted to show 0hrs and 0 mins as default selected time interval of the countdown timer. if there is a change, the timer is automatically set to that value using event handling (did end editing). However, 0hrs and 1 mins is what the default timer shows which can come across as the timer being preset to 1 minute. How can I design my user-interface such that the default is indicated as 0hr 0mins and if the user changes it, its set to that time. This is more of a design question. Maybe something in HIG? Here is how it currently looks...
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
593
Feb ’24
Not receiving Persistent Store Remote Change Notification.
Before the code... CloudKit, background mode (remote notifications) and push notifications are added to Capabilities. Background sync is working fine and view loads current store on manual fetch. Code that initialises the persistent container in app delegate... - (NSPersistentCloudKitContainer *)persistentContainer {     // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it.     @synchronized (self) {         if (_persistentContainer == nil) {             _persistentContainer = [[NSPersistentCloudKitContainer alloc] initWithName:@"Expenses"];             [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) {                 if (error != nil) {                     __block NSPersistentStoreDescription *sDescription = storeDescription;                     dispatch_async(dispatch_get_main_queue(), ^(){                         [sDescription setOption:[NSNumber numberWithBool:YES] forKey:@"PersistentHistoryTracking"];                         [sDescription setOption:[NSNumber numberWithBool:YES] forKey:@"NSPersistentStoreRemoteChangeNotificationOptionKey"];                     }); #ifdef DEBUG                     NSLog(@"Unresolved error %@, %@", error, error.userInfo); #endif                     abort();                 }                 else #ifdef DEBUG                     NSLog(@"Store successfully initialized"); #endif             }];         }     }     return _persistentContainer; } In Home view controller which is the initial view controller i am adding an observer for the remote notification...     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadViewONCKChangeNotification) name:NSPersistentStoreRemoteChangeNotification object:[appDelegate.persistentContainer persistentStoreCoordinator]]; I am not receiving any store change notifications. Have added breakpoints to see if selector is fired. no go. CloudKit Console also doesn't show any pushes for the concerned time period.
4
0
1.9k
Jan ’24
Mistakenly deleted Debug settings in 'Build Settings' while checking for NSLog outputs in debugger
I was trying to toggle Debug settings in Build Settings to check if NSLog statements between #ifdebug and #endif stop printing in the debugger.I ended up deleting the settings thinking cmd+z will undo it. Can you help me get them back? I'm asking about the one that says DEBUG=0 or DEBUG=1 Also, If I can know how to toggle them? Thank you.
1
0
563
Sep ’23
develop 1 project on 2 macs?
I have two macs at home. One in my bedroom which is my development mac and one in my living room which is an old mac i put to good use. i would like to occasionally sit in my living room and continue my work from there to avoid fatigue sitting at my desk all day. i have enabled source control using local git repo. how can i continue with my xcode project on my second mac which runs the same os x?
19
0
15k
Jul ’23
Call swift code from objc code in objc project
I read the article here... https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_swift_into_objective-cand this is what I did.Created a header file for swift file.added @class SwiftFile.h#import MyAppTargetName-Swift.h in the objc file from where I want to reference my swift code.Now in my swift file when I write...@interface ClassName { MySwiftClass *swiftClass; }I get error message Unknown Type Name "MySwiftClass".How can I resolve this and get going?Am I doing something wrong?Does the bridging header i created along with the swift file need to me edited?Neerav
17
0
14k
Dec ’22
Local user Notification not triggering inspite of authorisation
Below is my code that cancels previous notification and should trigger a new one for the set time. Code runs without error but i dont see any notification. I have taken concrete authorisation for the same and there are no run time errors in the trigger below. previously when the authorisation was provisional, the notification would fire fine upon subsequent time changes. Not it just doesnt show up. Please help me out. -(void)makeNotificationFromDateComponents:(NSDateComponents *)dateComponents { [[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests]; UNMutableNotificationContent *notificationContent = [[UNMutableNotificationContent alloc] init]; notificationContent.title = @"title"; notificationContent.body = @"body."; notificationContent.sound = [UNNotificationSound defaultSound]; UNCalendarNotificationTrigger *notificationtrigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:YES]; UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:@"AddReminderNotification" content:notificationContent trigger:notificationtrigger]; [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:notificationRequest withCompletionHandler:^(NSError *error){ if (error!=nil) { NSLog(@"Notification error: %@",error.userInfo); } }]; }
2
0
1.6k
Nov ’22
How to resize items in collection view to perfectly fit bigger screen sizes?
I have a collection view with vertical flow layout. On bigger iPhones there is empty space after the 5 items in the row. Height and width and fixed at 30. There is empty space horizontally after the 5th item in the row. If i turn height and width constraint to be 'greater that of equal to' then i see just 3 items in the row and the remaining 2 appear in the row below. I find constraints very challenging and want guidance with setting them right so that the items resize on all screens to have exactly 5 items in a row from edge to edge of the collection view.
2
0
1.9k
Oct ’22
Text alignment NSTextAlignmentRight in UITableViewHeaderFooterView's textLabel for table view section header not working.
I'm trying to right align the text that is shown up in the table view section header from its datasource call viewForHeaderInSection using the following code but the text is still left aligned. I tried other alignment options but none worked. Can someone help me out please. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UITableViewHeaderFooterView *headerView = [[UITableViewHeaderFooterView alloc] initWithFrame:CGRectMake(legendTableView.frame.origin.x, legendTableView.frame.origin.y, legendTableView.frame.size.width, 10)]; headerView.textLabel.textAlignment = NSTextAlignmentRight; double total= 0; for (Amount *amountObj in currentArray) { total=total+[amountObj.amount doubleValue]; } NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; currencyFormatter.numberStyle = NSNumberFormatterCurrencyStyle; NSString *amountString = [currencyFormatter stringFromNumber:[NSNumber numberWithDouble:total]]; NSString *totalString = [NSString stringWithFormat:@"Total: %@",amountString]; headerView.textLabel.text = totalString; return headerView; } Thanks. Neerav
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
862
Sep ’22
setDate method of UIDatePickerView in compact mode (time only) doesn't update time. Only shows current time.
Inspite of datecomponents being what I set to (i.e, 12 PM) and the date object being correct -5:30 hours from my time zone IST), when I try and set the date on the picker using setDate:Animated: method, the time remains to current time (ie, the time the view controller containing the picker appears). Can someone explain what could be wrong? - (void)viewDidLoad {     [super viewDidLoad];     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];     NSData *hAndMData = [[NSUbiquitousKeyValueStore defaultStore] objectForKey:@"AddReminder"];     NSError *error;     hoursAndMinutes = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDateComponents class] fromData:hAndMData error:&error];     if (error!=nil) {         NSLog(@"error in unarchiving date componenet in settingsVC: %@",error);     }     else     {         dateForNotification = [[NSCalendar currentCalendar] dateFromComponents:hoursAndMinutes];     } } -(void)viewDidAppear:(BOOL)animated {     [super viewDidAppear:YES];     [reminderCell.addReminderTVCTimePicker setDate:dateForNotification animated:YES]; } Thanks Neerav
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
584
Sep ’22
Local Notification wont fire.
Capabilities- push notification. Time sensitive notification. Added below is my method that requests for and sets up notification… (void)authorizeAndCreateNotificationFromDateComponents:(NSDateComponents *)dateComponents { UNUserNotificationCenter *notificationCenter = [UNUserNotificationCenter currentNotificationCenter]; [notificationCenter requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionProvisional completionHandler:^(BOOL granted, NSError *error){ if (granted) { UNMutableNotificationContent *notificationContent = [[UNMutableNotificationContent alloc] init]; notificationContent.title = @"Add"; notificationContent.body = @"Is it time. Tap to add."; UNCalendarNotificationTrigger *notificationtrigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:YES]; UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:@"AddReminder" content:notificationContent trigger:notificationtrigger]; [notificationCenter addNotificationRequest:notificationRequest withCompletionHandler:^(NSError *error){ if (error!=nil) { NSLog(@"Notification error: %@",error.userInfo); } }]; } }]; } i call this method from application did finish launching with the following code… NSDateComponents *hoursAndMinutes = [[NSCalendar currentCalendar] components:NSCalendarUnitHour|NSCalendarUnitMinute fromDate:[NSDate dateWithTimeIntervalSinceNow:20]]; [self authorizeAndCreateNotificationFromDateComponents:hoursAndMinutes]; I am testing this on a device and i dont see any notifications. Although i did see the app in settings.app and immediate, time sensitive and silent (only in notification center without badge or sound) notification have been enabled. what could be wrong?
1
0
746
Aug ’22
UIDatePickerView compact not highlighting selection.
i have a UIDatePickerView in compact style and for some reason highlighting of selected date has stopped working. I notice that the date is selected (from action method valueChanged) but the light blue circle highlighting the date is not showing up. what could be the reason? i am using storyboard and objective c
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
762
Aug ’22
Un-swipe tableview cell after action is selected?
I have a couple of actions in the leading and the trailing swipes of a table view cell. Like in the mail app, I want to unswipe the cell as soon as an action is selected. Notice how the 'Mark as read' blue colored action disappears when its selected. Any guesses how it can be done? Neerav
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
0
Boosts
0
Views
537
Activity
Feb ’24
How to design for 0hrs 0mins countdown timer as default (indicating timer not set).
In my app, its optional that a user sets a timer for a given thing. For that, I wanted to show 0hrs and 0 mins as default selected time interval of the countdown timer. if there is a change, the timer is automatically set to that value using event handling (did end editing). However, 0hrs and 1 mins is what the default timer shows which can come across as the timer being preset to 1 minute. How can I design my user-interface such that the default is indicated as 0hr 0mins and if the user changes it, its set to that time. This is more of a design question. Maybe something in HIG? Here is how it currently looks...
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
0
Boosts
0
Views
593
Activity
Feb ’24
Not receiving Persistent Store Remote Change Notification.
Before the code... CloudKit, background mode (remote notifications) and push notifications are added to Capabilities. Background sync is working fine and view loads current store on manual fetch. Code that initialises the persistent container in app delegate... - (NSPersistentCloudKitContainer *)persistentContainer {     // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it.     @synchronized (self) {         if (_persistentContainer == nil) {             _persistentContainer = [[NSPersistentCloudKitContainer alloc] initWithName:@"Expenses"];             [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) {                 if (error != nil) {                     __block NSPersistentStoreDescription *sDescription = storeDescription;                     dispatch_async(dispatch_get_main_queue(), ^(){                         [sDescription setOption:[NSNumber numberWithBool:YES] forKey:@"PersistentHistoryTracking"];                         [sDescription setOption:[NSNumber numberWithBool:YES] forKey:@"NSPersistentStoreRemoteChangeNotificationOptionKey"];                     }); #ifdef DEBUG                     NSLog(@"Unresolved error %@, %@", error, error.userInfo); #endif                     abort();                 }                 else #ifdef DEBUG                     NSLog(@"Store successfully initialized"); #endif             }];         }     }     return _persistentContainer; } In Home view controller which is the initial view controller i am adding an observer for the remote notification...     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadViewONCKChangeNotification) name:NSPersistentStoreRemoteChangeNotification object:[appDelegate.persistentContainer persistentStoreCoordinator]]; I am not receiving any store change notifications. Have added breakpoints to see if selector is fired. no go. CloudKit Console also doesn't show any pushes for the concerned time period.
Replies
4
Boosts
0
Views
1.9k
Activity
Jan ’24
Mistakenly deleted Debug settings in 'Build Settings' while checking for NSLog outputs in debugger
I was trying to toggle Debug settings in Build Settings to check if NSLog statements between #ifdebug and #endif stop printing in the debugger.I ended up deleting the settings thinking cmd+z will undo it. Can you help me get them back? I'm asking about the one that says DEBUG=0 or DEBUG=1 Also, If I can know how to toggle them? Thank you.
Replies
1
Boosts
0
Views
563
Activity
Sep ’23
develop 1 project on 2 macs?
I have two macs at home. One in my bedroom which is my development mac and one in my living room which is an old mac i put to good use. i would like to occasionally sit in my living room and continue my work from there to avoid fatigue sitting at my desk all day. i have enabled source control using local git repo. how can i continue with my xcode project on my second mac which runs the same os x?
Replies
19
Boosts
0
Views
15k
Activity
Jul ’23
Call swift code from objc code in objc project
I read the article here... https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_swift_into_objective-cand this is what I did.Created a header file for swift file.added @class SwiftFile.h#import MyAppTargetName-Swift.h in the objc file from where I want to reference my swift code.Now in my swift file when I write...@interface ClassName { MySwiftClass *swiftClass; }I get error message Unknown Type Name "MySwiftClass".How can I resolve this and get going?Am I doing something wrong?Does the bridging header i created along with the swift file need to me edited?Neerav
Replies
17
Boosts
0
Views
14k
Activity
Dec ’22
Local user Notification not triggering inspite of authorisation
Below is my code that cancels previous notification and should trigger a new one for the set time. Code runs without error but i dont see any notification. I have taken concrete authorisation for the same and there are no run time errors in the trigger below. previously when the authorisation was provisional, the notification would fire fine upon subsequent time changes. Not it just doesnt show up. Please help me out. -(void)makeNotificationFromDateComponents:(NSDateComponents *)dateComponents { [[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests]; UNMutableNotificationContent *notificationContent = [[UNMutableNotificationContent alloc] init]; notificationContent.title = @"title"; notificationContent.body = @"body."; notificationContent.sound = [UNNotificationSound defaultSound]; UNCalendarNotificationTrigger *notificationtrigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:YES]; UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:@"AddReminderNotification" content:notificationContent trigger:notificationtrigger]; [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:notificationRequest withCompletionHandler:^(NSError *error){ if (error!=nil) { NSLog(@"Notification error: %@",error.userInfo); } }]; }
Replies
2
Boosts
0
Views
1.6k
Activity
Nov ’22
How to resize items in collection view to perfectly fit bigger screen sizes?
I have a collection view with vertical flow layout. On bigger iPhones there is empty space after the 5 items in the row. Height and width and fixed at 30. There is empty space horizontally after the 5th item in the row. If i turn height and width constraint to be 'greater that of equal to' then i see just 3 items in the row and the remaining 2 appear in the row below. I find constraints very challenging and want guidance with setting them right so that the items resize on all screens to have exactly 5 items in a row from edge to edge of the collection view.
Replies
2
Boosts
0
Views
1.9k
Activity
Oct ’22
Text alignment NSTextAlignmentRight in UITableViewHeaderFooterView's textLabel for table view section header not working.
I'm trying to right align the text that is shown up in the table view section header from its datasource call viewForHeaderInSection using the following code but the text is still left aligned. I tried other alignment options but none worked. Can someone help me out please. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UITableViewHeaderFooterView *headerView = [[UITableViewHeaderFooterView alloc] initWithFrame:CGRectMake(legendTableView.frame.origin.x, legendTableView.frame.origin.y, legendTableView.frame.size.width, 10)]; headerView.textLabel.textAlignment = NSTextAlignmentRight; double total= 0; for (Amount *amountObj in currentArray) { total=total+[amountObj.amount doubleValue]; } NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; currencyFormatter.numberStyle = NSNumberFormatterCurrencyStyle; NSString *amountString = [currencyFormatter stringFromNumber:[NSNumber numberWithDouble:total]]; NSString *totalString = [NSString stringWithFormat:@"Total: %@",amountString]; headerView.textLabel.text = totalString; return headerView; } Thanks. Neerav
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
1
Boosts
0
Views
862
Activity
Sep ’22
setDate method of UIDatePickerView in compact mode (time only) doesn't update time. Only shows current time.
Inspite of datecomponents being what I set to (i.e, 12 PM) and the date object being correct -5:30 hours from my time zone IST), when I try and set the date on the picker using setDate:Animated: method, the time remains to current time (ie, the time the view controller containing the picker appears). Can someone explain what could be wrong? - (void)viewDidLoad {     [super viewDidLoad];     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];     NSData *hAndMData = [[NSUbiquitousKeyValueStore defaultStore] objectForKey:@"AddReminder"];     NSError *error;     hoursAndMinutes = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDateComponents class] fromData:hAndMData error:&error];     if (error!=nil) {         NSLog(@"error in unarchiving date componenet in settingsVC: %@",error);     }     else     {         dateForNotification = [[NSCalendar currentCalendar] dateFromComponents:hoursAndMinutes];     } } -(void)viewDidAppear:(BOOL)animated {     [super viewDidAppear:YES];     [reminderCell.addReminderTVCTimePicker setDate:dateForNotification animated:YES]; } Thanks Neerav
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
1
Boosts
0
Views
584
Activity
Sep ’22
Local Notification wont fire.
Capabilities- push notification. Time sensitive notification. Added below is my method that requests for and sets up notification… (void)authorizeAndCreateNotificationFromDateComponents:(NSDateComponents *)dateComponents { UNUserNotificationCenter *notificationCenter = [UNUserNotificationCenter currentNotificationCenter]; [notificationCenter requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionProvisional completionHandler:^(BOOL granted, NSError *error){ if (granted) { UNMutableNotificationContent *notificationContent = [[UNMutableNotificationContent alloc] init]; notificationContent.title = @"Add"; notificationContent.body = @"Is it time. Tap to add."; UNCalendarNotificationTrigger *notificationtrigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:YES]; UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:@"AddReminder" content:notificationContent trigger:notificationtrigger]; [notificationCenter addNotificationRequest:notificationRequest withCompletionHandler:^(NSError *error){ if (error!=nil) { NSLog(@"Notification error: %@",error.userInfo); } }]; } }]; } i call this method from application did finish launching with the following code… NSDateComponents *hoursAndMinutes = [[NSCalendar currentCalendar] components:NSCalendarUnitHour|NSCalendarUnitMinute fromDate:[NSDate dateWithTimeIntervalSinceNow:20]]; [self authorizeAndCreateNotificationFromDateComponents:hoursAndMinutes]; I am testing this on a device and i dont see any notifications. Although i did see the app in settings.app and immediate, time sensitive and silent (only in notification center without badge or sound) notification have been enabled. what could be wrong?
Replies
1
Boosts
0
Views
746
Activity
Aug ’22
UIDatePickerView compact not highlighting selection.
i have a UIDatePickerView in compact style and for some reason highlighting of selected date has stopped working. I notice that the date is selected (from action method valueChanged) but the light blue circle highlighting the date is not showing up. what could be the reason? i am using storyboard and objective c
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
2
Boosts
0
Views
762
Activity
Aug ’22