William Boles
  • William Boles
  • Home
  • About
  • Favourites
  • Mind Maps

Custom setter and getters

#memory management #properties

In Objective-C, a property can have the following attributes applied to it: * atomic * nonatomic * assign * retain * copy The scenerio is that these attributes are applied to the properties for us but what happens if we want setting/getting a property's value to have a side-effect? In

25 Mar 2011 • 1 min read

Build the tab-bar from a plist

#ui

Working in a team, I often find myself trying to avoid using Interface Builder (IB) as much as possible. This is because trying to resolve the inevitable conflicts that arise when two developers change the same xib can be soul-destroying ⚰️. A sea of seemingly unrelated xml changes awaits anyone who

24 Mar 2011 • 2 min read

Dynamically sizing UILabel

#ui

I use the below category when working with dynamic content. It has useful methods for setting up a UILabel frame based upon its content and restrictions that you place on it. .h @interface UILabel(Size) /* @method Adjusts UILabel's frame to begin at defined x and y position and have a dynam

23 Mar 2011 • 2 min read

Pop back multiple viewcontrollers

#ui

I sometimes find myself creating applications that have a Home viewcontroller and all other views should allow the user to directly return to this Home viewcontroller. I don't just want to push a fresh copy of the Home viewcontroller on the navigation stack. Instead, I need to loop through the n

20 Mar 2011

Core Data terms

#core data #persistence

I'm often asked to explain Core Data to the new joiners. I thought I'd share what I tell them about the components that make up Core Data: 1. Persistent store - is where Core Data stores its data, more often in a form of a SQLLite database but can be Atomic (binary store) or In-Memor

11 Mar 2011 • 1 min read

Custom loading view

#ui

A common want in any application that communicates with a web service is to add a loading/loader view to show your user that the application is busy getting data and has not crashed. I've came up with a generic loading view that I use on multiple applications, its split into two methods, one to

02 Feb 2011 • 2 min read

Hidden method arguments

#memory management

Objective-C automatically passes two hidden method arguments with ever method call: * self - the object that the method is executing inside * _cmd - method's message call Here's an example of using _cmd: NSLog(@"%@", NSStringFromSelector(_cmd));

31 Jan 2011

Custom getter and setter names

#properties

When editing legacy code you sometimes come across the scenario where a getter and setter method has been created that performs the same job as a property would but a property wasn’t used. So you decide to tidy it and create a property for that instance variable. However the getter and setter don’t

29 Jan 2011 • 1 min read

Calling a class method from an instance method

#memory management

A colleague recently came to me with a bug in his code, that he just couldn’t solve. He was attempting to call a static/class method from inside an instance method of his class using self, assuming that as self was an instance of the class it would have access to all the methods defined in that clas

28 Jan 2011 • 1 min read

What `isa` is for

#memory management

When using the debugger within Xcode, you see that each object has a isa variable. For those, like me, curious about what is does. When you use alloc on a class, you are actually creating space in memory which is temporary filled, at the bottom of this space you point to another memory address. Th

28 Jan 2011 • 1 min read

Search your table's data

#ui #core data

Adding search functionality to your UITableView can be achieved using the built in UISearchBar object and implementing the UISearchBarDelegate protocol. I am going to take us through an example that searches an Article instances (data object) properties for the users entered search string, displayin

24 Jan 2011 • 3 min read

Adding multi-threaded support simply

#concurrency

In iOS there are two ways to support multi-threading in your app: subclass NSOperation or use the more specialised NSInvocationOperation. NSInvocationOperation (which a concrete subclass of NSOperation) is intended to perform work using the target-action pattern. So whereas with a standard NSOperati

21 Jan 2011 • 1 min read

Sticky UIPickerView

#ui

Recently on an application I came across an issue where when I showed a UIPickerView inside an action sheet the bottom half(ish) of the pickerview wasn't selectable. I had came across this before when showing buttons in an UIActionSheet and had overcome it by moving the button slightly higher

22 Dec 2010 • 1 min read

Reflection

#reflection

To retrieve the properties for an object, you use: unsigned int outCount; objc_property_t *propList = class_copyPropertyList([objectToInspect class], &outCount); propList will contain an array of the properties found inside objectToInspect, with outCount containing the total number of properti

16 Dec 2010
Page 6 of 7

No results for your search, please try with something else.

William Boles © 2025

GitHub | Mastodon | Bluesky | LinkedIn | RSS

JavaScript license information