Custom NSTableViewCell labels not appearing

I’m working on an iPhone app at the moment that is being upgraded from a previous version. I decided early on to just build on the existing code rather than trying to reinvent the wheel.

I’ve spent a bit of time fixing warnings that have cropped up from changes in the iOS SDK (the original app was developed for iOS 2) but one problem in particular had me stumped for a while.

When subclassing NSTableViewCell, the old init method was:

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier

but somewhere along the line the init method definition changed to:

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

I’m yet to find out when this changed occurred, but it left me with the problem of no longer having access to the “frame” parameter. This meant the code in the init method that used to size the views of the custom cell no longer had a point of reference.

It took me a while to figure out that due to this change there was also another new method introduced that now had to be overridden to size the custom cell views:

-(void)layoutSubviews

In this method is where we are now meant to set the size of the custom cell views.

So I commented out the sizing code that used to be in the init method and moved it to the new layoutSubviews method as follows:

-(void)layoutSubviews
{
    [super layoutSubviews];
    CGRect label, steps;
    CGRect bounds = [[self contentView] bounds];
    label.origin.x = 20.0;
    label.origin.y = 3.0;
    label.size.height = bounds.size.height - (label.origin.y*2);
    label.size.width = 160.0;
    [dateLabel setFrame:label];

    steps.origin.x = 170.0;
    steps.origin.y = 5.0;
    steps.size.height = bounds.size.height - (steps.origin.y*2);
    steps.size.width = 120.0;
    [stepsLabel setFrame:steps];
}

This fixed my issue. Running the app now showed the custom cell labels as expected.

Word 2011 – Share as Email Attatchment

I recently had a staff member who was having trouble emailing word documents from within Word. To be honest I never actually realised you could do this. I’d never even thought about trying it.

Anyway, Word 2011 has a feature under the “File -> Share” menu that allows you to email the current document as an attachment.

The staff member was trying to use it with Outlook 2011, but the email kept being created in Mac Mail. I went into Mac Mail preferences and made sure Outlook 2011 was the default email client. I thought this was a systemwide setting and that other applications would use the setting when trying to send email.

Turns out that Word 2011 doesn’t use this setting as even with it set to Outlook, it still kept trying to use Mac Mail.

It was then that I discovered that Outlook 2011 has a setting under preferences -> general, that sets Outlook as the default email client.

We clicked this button and tried again and it worked.

So, why doesn’t Word 2011 use the default as set by Mac Mail? Why do I have to set it in Outlook for it to take notice? Seems a little strange to me.

Deploying SCCM OSD image to mac bootcamp partition

I’ve spent a good part of the last week trying to get the unis windows 7 MOE to install on a bootcamp partition. Little did I know when I started that it was a complicated process with obstacles all along the way.

To cut a long story short I could not find a way to get the iMac to boot and pull the SCCM image via the network. I even tried booting from a set of SCCM OSD dvds that the sys admin guys burnt. That too didn’t work and kept bugging out when the SCCM installer would try to set the windows partition to be active.

So…. In the end the solution that worked is as follows:
* Run bootcamp assistant to setup the partition
* Insert a standard windows installation DVD and reboot
* Hold down the “Option” key to get a boot menu
* Select the dvd and then press the “Space bar” until the windows menu appears (See previous blog on why pressing space is needed)
* Install windows, use generic info because this install will be getting overwritten with the SCCM image soon.
* Once installed, insert the SCCM OSD disk and run the autorun.
* SCCM installer will kick off and start staging the image for deployment.
* System will reboot and installation will kick off

Doing it this way seems to get around the “Setting the partition active” problem. I guess if windows is already installed then the SCCM OSD installer just skips trying to set the partition as active.

So I managed to get the unis windows 7 SCCM image deployed to a bootcamp partition of an iMac. Monday will be time to kick DeployStudio into gear and create the dual boot master images. Then try to deploy it out to some other test systems.

Everything going ok I’m hoping to be deploying dual boot images to macs by the end of next week.

After that, it’s on to setting up Munki and getting it working.

Office 2011 Mac – Crashing when copying and pasting

I have a user at work who has been having constant and regular issues with Word 2011. I couldn’t really narrow it down but it will just crash and he will lose his work.

The common action he did when the crash happened was to cut/copy + paste.

Once again, trawling google and forums seems to have provided a solution (and yet again the actual microsoft support suggestions are useless).

In this case I got him to:
* Click the “Word” menu and choose “Preferences”
* In the window that opens, click “Edit” under the “Authoring and Proofing Tools” section
* The “Edit” window loads. About half way down is an option called “Use smart cut and paste”
* Untick this option so it’s NOT selected.
* Click “OK”
* Restart Word (cause microsoft stuff seems to like that)
* See how it goes.

I haven’t heard back from the user in 4 days, so for me that’s another issue solved.

Book Update

I recently finished book 1 of the “A Game of Thrones” story. The book was awesome. The second half of the book seems to fly past and I’m keen to get stuck into the next book.

I have taken a slight detour though from the second book and instead I’m reading “The man who mistook his wife for a hat” by Oliver Sacks. It’s an amazing book with unbelievable stories. Really makes me think about what the human brain and body is capable of. I’m halfway through it already and it’s a pretty easy read.

I’ve also placed another book order with Amazon UK. I’ve got quite a long reading list now but I think that’s good.

One interesting side effect from regularly reading is that I seem to be having (and remembering) dreams when I sleet. Really vivid dreams. It’s good.

Bootcamp – Flashing cursor when booting

I’m currently building a dual boot MOE image for our mac labs and came across a weird problem when trying to install windows 7 under bootcamp.

The bootcamp assistant would run fine, partition the drive then reboot. I had a windows 7 cd in the drive but the iMac would just reboot and display a black screen with a flashing white cursor in the top left corner of the display.

I trawled support forums for a few days looking for ideas but non of the many suggested worked until I tried the following:

  • Run the bootcamp assistant as normal, partition the drive etc
  • Start the iMac
  • Hold down the “Option” key to get the boot menu
  • Choose the windows installation DVD
  • As soon as you choose it, start tapping the space bar
  • A screen should appear with a windows style boot menu where you can select the windows installation and away it goes.

From there the windows installation kicked off and worked as expected.