Showing posts with label property. Show all posts
Showing posts with label property. Show all posts

Thursday, November 25, 2010

Accessing Unknown 'cornerRadius' Component of a Property

Wanted to create rounded corners for a component, done this before in another project. Suddenly it doesn't work any more:
button.layer.cornerRadius = 8.0f;
Forgot to include header:
#import <QuartzCore/QuartzCore.h>
Error code kind of hinted in that direction, I guess... Wasn't very obvious. Btw check that CoreGraphics.framework is already included in project.

Thursday, October 28, 2010

EGOTableViewPullRefresh for multiple UITableViews

Wanted to add a "Pull To Refresh" feature similar to Tweetie2, so i looked around to see if there was any reusable code (screenshot from Zattr).

Cocoanetics (ex-Dr. Touch) has a good article explaining"pull to refresh" internal workings, well worth investing the time and effort to read. Recommended! However he's solution was not reusable for me, since I don't have UITableViewController. Fortunately he referenced Enormego's solution using UITableViews, including a walk-through with changes.

Monday, March 22, 2010

Property 'username' attribute in 'ConnectApi' class continuation does not match 'ConnectApi' class property

Want to declare external API as readonly, while internal has to be writable. Done this before, but right now something doesn't work.

Turned out that the reason is missmatch in unwritten default values. The property types must match in both external and internal declaration, including the non-written default values. This is the correct version:
@interface ConnectApi : NSObject
{
    NSString *username;
}
@property (nonatomic, copy, readonly) NSString *username;
...
@interface ConnectApi ()
@property (nonatomic, copy, readwrite) NSString *username;