iPhone UITableView – Delete Button

For me the best way to solve this was overriding -(void)layoutSubviews in MyCell:UITableViewCell Here you can see not only the Delete button custom position, but also repositioning the Edit and Reorder controls for Edit mode – (void)layoutSubviews { [super layoutSubviews]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:0.0f]; for (UIView *subview in self.subviews) { if ([NSStringFromClass([subview … Read more

Change position of UIBarButtonItem in UINavigationBar

This code creates a back button for UINavigationBar with image background and custom position. The trick is to create an intermediate view and modify its bounds. Swift 5 let menuBtn = UIButton(type: .custom) let backBtnImage = UIImage(named: “menu”) menuBtn.setBackgroundImage(backBtnImage, for: .normal) menuBtn.addTarget(self, action: #selector(showMenuTapped), for: .touchUpInside) menuBtn.frame = CGRect(x: 0, y: 0, width: 45, height: … Read more

Checkbox image toggle in UITableViewCell

It’s actually pretty easy. Just create a new subclass of UIControl and put it all in there (no need for a separate controller.) Let’s call it ToggleImageControl. @interface ToggleImageControl : UIControl { BOOL selected; UIImageView *imageView; UIImage *normalImage; UIImage *selectedImage; } Create a ToggleImageControl for each cell, and add it at the appropriate position. ToggleImageControl … Read more

core data in a static library for the iPhone

Sascha’s answer got me on the right track. Merging a compiled .mom file from a static library into the .mom file from a host project was relatively simple. Here’s a trivial example: Create a new XCode Static Library project called MyStaticLibrary Create an .xcdatamodel file in MyStaticLibrary called MyStaticLibraryModels.xcdatamodel, add some Entitys, then generate the … Read more