Luke Tupper Consulting

Luke Tupper Consulting Blog

Doing Big Text in UITableView

September6

If you need to display differing size text in a UITableView here is some sample code that uses standard UITableViewCells and changes the height depending on the size of the Table View (handles rotation ok).

The main sections of code is the heightForRowAtIndexPath:

NSString *bigText = [self.bigTexts objectAtIndex:indexPath.row];
CGSize textSize = [bigText sizeWithFont:self.labelFont
constrainedToSize:CGSizeMake(tableView.frame.size.width - 40.0, MAXFLOAT) //40 should be the margin needed for controls etc.
lineBreakMode:UILineBreakModeWordWrap];
return textSize.height;

And the initialisation of the TableViewCell:

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Configure the cell.
cell.textLabel.numberOfLines = 0;
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.text = (NSString *)[self.bigTexts objectAtIndex:indexPath.row];
cell.textLabel.font = self.labelFont;

return cell;

I have uploaded the complete project for those who want to run it straight out of the box.

decodeRetainedObject error when using Distributed Objects (DO)

December28

Came across an interesting problem. Trying to get distributed objects to pass a common class between processes.

To avoid versioning issues I had the class in a shared location so that both client and server could use it.

On the server I was seeing a decodeRetainedObject: class ‘bleh’ not loaded error in the console log. Took a while to figure out, but XCode doesn’t automatically assign a class that are dragged and dropped into a project to the main target. The files simply needed to be assigned to the requisite target and everything works fine.

posted under Cocoa, MacOSX, XCode | No Comments »

Code Coverage in XCode

August29

While working with the latest version of Duplicate Image Detector I was hoping to see the amount of code coverage in the unit tests.

I was happy to see that the code coverage tools are built into GCC, but disappointed to see that it isn’t the easiest to meaniful statistics added to part of the build process. There is a great post at SuperMegaUltraGroovy.Com listing how to get code coverage enabled for your unit tests.

The one step I couldn’t complete is the code that needs to be inserted into the the Run Script after your test case run code. The code was a bit managled by Safari/Wordpress and even sorting that out I still had some issues.

Well after a bit of hacking around I found this code works pretty well (you will need to edit the framework name):


# Run the unit tests in this test bundle.
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
# Run gcov on the framework getting tested
if [ "${CONFIGURATION}" = 'Test' ];
then
FRAMEWORK_NAME=DID-V2.0
FRAMEWORK_OBJ_DIR=${OBJROOT}/${FRAMEWORK_NAME}.build/${CONFIGURATION}/${FRAMEWORK_NAME}.build/Objects-normal/${NATIVE_ARCH}
mkdir -p coverage
pushd coverage
echo ${OBJROOT}
echo ${FRAMEWORK_OBJ_DIR}
find ${FRAMEWORK_OBJ_DIR} -name *.o -exec gcov -b -o ${FRAMEWORK_OBJ_DIR} {} \;
popd
fi

This will produce the following information after the unit tests when you run your test:


File '/Users/tupps/Development/LTConsult/svn/DID/v2/ImageMatchManagement.m'
Lines executed:70.00% of 40
Branches executed:100.00% of 34
Taken at least once:64.71% of 34
Calls executed:86.21% of 29
/Users/tupps/Development/LTConsult/svn/DID/v2/ImageMatchManagement.m:creating 'ImageMatchManagement.m.gcov'

I hope this helps get a few people closer to running unit tests and looking at their code coverage on the mac. A nice utility like shark would be fantastic for working through these files and all of the information that is exported.
ass master
antique school desk
uma thurman nude
nude marykate and ashley olsen
ass to mouth jenna jameson
her first pet sex
granny grandson fucking
acer usb tablet boot
horny baby sitter
men swallow cum
xxx ass
old bitches tits
naked indian men
south korean tranny bars
chinese oriental dresses pics
glamour ladies nylons
hot latina porn
wet breasts
butt rub
oriental girls gallery
antique double sink bathroom vanities
tan stockings sex
mom daughter lesbian sex
women celebrities exposed
free gay military men
bare bottom spanking clips
nude family beach
hot hairy
paris hilton caught without panties
hentai hot toon sex
gothic adult webcam
dogs having sex with men
exploited black teen passwords
guys wearing nylons and panties
extreme hairy
large butt plugs
elephant penis
ebony lesbo
booty barker nextel cup crew chief
orthopedic foundation for animals
adult chat operator
bypass school firewall
1001 ways to eat my jizz
dd breasts
horny xxx
thong flashing gallery
smooth shaved
lesbian hentai dildo
moms fucking their sons
dog houses for large dogs
k-12 student safety
bree olsen interracial videos
studs cumming gay
girls who spread legs
gothic teen jizz
dick licking
tattoo ideas for girls
hottie college coed
granny topless
filipina manila sex
waningmoon gothic personals
hermione granger naked
enormous ebony dick
extreme geek
bi husband xxx
porn movie galleries
blond sex clips
panties fuck
hot blonde office sex
hidden boy cam
old hairy men
ebony tranny gape
black bitch galleries
ebony female ejaculation
girls on cam
free sexcams no e-mail
beach teen bikini pics
anti gag cream
olsen twincest
celebrity uncensored
military sexual assault
fuck dog
fingering cunts
nun sex
revolving grooming table dogs
birthday cake clip art
ebony huge tits
stocking porn galleries
free nurse video porn
girl suck a dick
articles on red heads
sexy grannies older women
micro bikinis model galleries
how to make penis bigger
secretary masturbation
skinny white pussy
twinks for cash tommy
girlfriends licking pussy ffm
milk nipple
masterbation parties
8 year old girl birthday party
12 year old girl in thongs
big tit chat rooms free
free webcam streaming chat
hairy pussy close up
the simpsons sex
office desk layout designs
gothic femdom
commercial large lazy susans
young nude boys
horny hitchhikers
mens cocks
old fuck
deep throat porn
bisexual femdom
zac efron nude
men shave body hair
hermione granger porn
free granny with girl gallery
heather deep throat
tranny pics
little girls
my friends hot mom porn site
big tits blowjobs
ghetto ass
her first huge dick
hot gothic nudes
mega cocks
penis pain
hot gothic nudes
double blower
big ass anal
brunettes in panties
female bodybuilder sex
free gangbang video
teen skinny dip
african tranny
sexy brunette sex
horny old man
naked horny babes
sexcam jasmin
hot brunette with huge titts
bi sex videos
fatty bbw
tight pussy close up
ass to mouth girls
lg m5500c-ba
tranny anal dildo
brazil tshirt womens
tera patrick cum
ebony girls fucking baseball bats
milf latinas
granny ass
hot sexy legs
home made porn facial
bbw gallery
girl masterbating in shower
yahh bitch yahh
flexible bondage
sexiest legs
tight long skirts
penis enormous
live cams adult
drunk blowjob
but im a cheerleader
symptoms of bi polar disorder
boot leg movies
kids fuck
kelly clarkson naked
harley chicks
big hairy cock
playboys book of lingerie
gay gag cum
free blowjob videos
enormous buttplug
gothic whores
black cum facials
milk my jizz
gangbang squad
extreme activities
gay giants
jack osbourne paparazzi pics
bestiality brazil
flex body building magazine
licking tit
fucking in stockings
bbw porn videos
1987 to 1003 ford mustang big block engine swap
first time deep throat
porn paysite passwords
pussy & ass closeups
free bbw pussy
tranny dick
granny fucks
teacher upskirt
cartoons fucking
gay ass fuck amateur free
clitoris closeup
funny nipples
cock pussy
gay sucking big cocks
dripping hairy pussy
grandma cum
xxx picture mary kay & ashley olsen
pussy on cam
fuck it eamon
hot gothic teen girls
yamaha rhino engine swap
filipina nudity
14 year old average penis size
horny old man
www. chicks wiyh dicks
interracial payperview porn
tattoos tribal art
big tits bbw porn
fake nude pictures of the olsen twins
student study team forms
petite lesbians oriental
big juicy butts
xtra large grannies

posted under Cocoa, Duplicate Image Detector, MacOSX, Useful Code | Comments Off

Useful Split View Sites

April13

I have been hunting for information about NSSplitView and ran into a couple of sites with some decent information about Split Views and its intricacies.

Split View Help:
http://homepage.mac.com/jrc/contrib/ — Code for collapsing NSSplitViews programmatically.

http://www.cocoadev.com/index.pl?RBSplitView — An implementation of splitviews which gives you more control.

Generally Useful Site:

http://borkware.com/ — I am surprised I haven’t come across this site before. Seems to have a heap of useful code snippets.

I will let you know how I go with the intricacies of the NSSplitView

Cocoa Bindings don’t stop my stupidity!

April7

The new version of Body Diary presents a list of additional fields to the user to fill in. The number of fields is determined by the user. This data hasn’t been assigned to coredata so I decided that the easiest way to show this would be to create a mutable array and have that as the data source for Cocoa Bindings. Whenever a record is added to the system the array is recreated.

My first attempt at working with the data I went straight to the array and editted the data. This left the display out of sync with the data. A quick scan of the documentation pointed out that I should be instead using the NSArrayController to manipulate the data. I modified my code but I was soon stuck with nothing working. I tried everything, recreating controller objects, modifying my code, stepping through line by line. Nothing worked and I was getting very close to just rewriting everything as traditional table delegate methods.

I decided to remove all my debugging trials and strip everything back to the bare essentials. Once I did this I noticed that the class controlling the window was crashing when I quit. It turns out that my code to set the MutableArray that the NSArrayController was using was back to front. So instead of retaining the newArray, releasing the old, and then assigning the new to the old, I was retaining and releasing correctly but was assigning the old to the new.

A quick switch of the code and my NSArrayController was behaving perfectly. So the old “Problem Exists Between Keyboard and Chair” strikes again.

Getting 2 Entities combined into 1 table in Core Data

April6

I was having a discussion with R. Tyler about getting 2 entities to combine into 1 table using CoreData/Cocoa Binding. We stretched the NSArrayController in all sorts of ways trying to get it to do something that it didn’t want to do.

Anyway I had a think about it over dinner, and it occurred to me that the solution probably isn’t in Interface Builder but in the model itself. After a bit of fiddling and some trial and error I found that it wasn’t too hard to accomplish. The basic twist that is needed is that you should have an abstract entity which is a parent for the two entities that you wish to combine.

The hook an array controller up to the parent entity and it will display all of the appropriate records. The only gotcha I found was that if your two entities have different fields that you want to display the missing fields will have to be added to the entity. Set these to transient so that the data saved in them will be ignored during saves.

I have a simple sample project up to demonstrate what is happening.

Core Data Initial Impression

April4

I have started working with core data for a couple of days now and I have a few first impressions:

The initial core data videos and tutorials take the easy path and show you the add a row to the table/delete a row from the table type example. The first version of Body Diary worked this way and I had a number of complaints about the user interface. It takes a little more effort to get this working correctly.

The bindings dialogs aren’t really intuitive. As I get used to the interface I am sure that I will understand it better once I have used it for a while.

I like the core data entity and relationship mapping. To me it feels like building a ER diagram for a database without having to worry about primary keys and foriegn key mappings. I would like to be able to drag and drop the relationships but that is probably a symptom of me spending to much time using Visio to document peoples databases.

In all I can see how core data will help me be more productive. Hopefully I will be able to climb up the initial learning curve in the next couple of days (I only get a couple of hours a day to work on Body Diary) and then bask in the speed that is developing applications using core data.

Body Diary being rewritten with Core Data

April2

I have decided to rewrite Body Diary using Core Data, after seeing Apple’s video tutorials on Core Data. Previously Body Diary hasn’t used either Core Data or Bindings, so this version will be a complete rewrite. The reason for using core data are:

  • Faster coding
  • No coding of sorting/filtering routines
  • Should create an app with better stability
  • I probably should learn these brand new technologies ;-)

Body diary is a pretty simple application so it should be an easy introduction for me to Core Data. The only real challenges I see with Body Diary are:

  • Need custom code to handle the charting module
  • Need code to import existing Body Diary files.

Also body diary will have a couple of new options. The main request people have is that they want to include an extra field or two. The main problem is that different people want to include different fields. Therefore I hope to incorporate the option to add any number of additional fields to the body diary application, and to chart those fields. The other main request is
for the charting module to show a floating average on the chart. I will also include the option to filter the results so you can view the graph for a set time frame.

Before diving in I thought I would read up a bit on Core Data. I have found the following useful: