Category Archives: Programming

Radio UTD

icon_512x512

After much development time, I am proud to say that my very first iOS application has been released into the App Store last week! Radio UTD is an app designed to make listening to the student-run radio station for The University of Texas at Dallas easy. Development time took longer than I anticipated, but I suppose it’s for the better as the code has evolved with me as I gained a better understanding of iOS and Objective-C development over the past couple of years.

I developed the app from scratch, using a few third-party libraries along the way. Version 1.0 is simple and clean so that there should be very little required maintenance in the coming years. It’s highly doubtful that future system administrators for Radio UTD will have a solid grasp of iOS development so I understand that future bug fixes and improvements are still on my head, even when I’ve move on job-wise.

I will open-source the code in the near future so that beginning developers can take a peek behind the hood to see what makes an Internet radio application tick. Make sure to check the app out on iTunes and check out Radio UTD for all your eclectic music needs!

How To Get Rid of UIMenuItems in the UIMenuController

The UIMenuController is something well loved by all iOS owners. With its introduction came copy/paste, a well received (and long due) feature. But what if one wants to harness the power of UIMenuController for their own gains?

It’s quite possible by utilizing the menuItems @property of the UIMenuController class. Simply stick in your NSArray containing UIMenuItems and you’re good to go, right? Well, maybe, but the following is what I got and it simply wasn’t good enough for me:

Notice how I was able to get my “Test” UIMenuItem inserted into the UIMenuController, it worked! However, the UIMenuController brought everyone else to the party leading to a very crowded feel (this actually filled my iPhone’s screen).

I wanted just my customer UIMenuItems in the controller. How to remove the rest of them? Well, if you try tapping on one of em, odd’s are your app will crash with an “unrecognized selector sent to instance” error. This actually turns out to be exactly what we need to get rid of the ones we don’t want! We are told which selector our UIView doesn’t implement and can filter it out in the canPerformAction:withSender: method that your UIView overrides. By utilizing the code below, I was able to get just my one custom UIMenuItem to display in the UIMenuController, exactly what I wanted!

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(copy:))
{
return NO;
}
if (action == @selector(cut:))
{
return NO;
}
if (action == @selector(paste:))
{
return NO;
}
if (action == @selector(select:))
{
return NO;
}
if (action == @selector(selectAll:))
{
return NO;
}
if (action == @selector(delete:))
{
return NO;
}
if (action == @selector(_setRtoLTextDirection:))
{
return NO;
}
if (action == @selector(_setLtoRTextDirection:))
{
return NO;
}
if (action == @selector(promptForReplace:))
{
return NO;
}
else
{
return YES;
}
}


This effectively got rid of the default UIMenuItems giving me my desired result as shown below: