4 posts tagged

Coursera Due

On date formatting

My app shows due dates, of course I need proper date formatting. Unfortunately NSDateFormatterStyle is not enough: it won’t let you specify anything about how you want your date to be displayed.

Yet there’s a class method on NSDateFormatter called dateFormatFromTemplate:options:locale: which gives you total control. The fun (and the most useful) thing about it is that you just need to give it components of a date, and it will arrange the format string automatically based on locale. Neat.

Don’t forget to do setDoesRelativeDateFormatting:NO, otherwise you’ll just get a blank string on the output. If you do need relative formatting at the same time with custom date format strings, here you go: NSDateFormatter+RelativeDateFormat.[hm]. I used this as a base for my own customization.

 No comments   2014   Coursera Due   iOS

Dynamic slider?

Not much to show for today except from the fact that I made the detail sheet to actually work. Also fixed the pixel guide problem I’ve written about yesterday: I’ve moved it off-center by 30 pixels and made Due and Deadline labels gray instead of heavy black, which made quite a difference!

Thinking about making the header into a dynamic slider, as the pictures are often taller than necessary. In this way if you slide the view down, margins around the grayed-out area on top will become wider to show more of the image. Not sure how to do it though and it’s not at the top of my priority list at the moment.

 No comments   2014   Coursera Due   iOS

Pixel guide

Had a blast (as in I said “Blast!” all day long) today with making a detail screen for homework assignments.

Among other things I needed to find a way to use Autolayout to balance three labels, one on the left, two on the right on top of each other, around the center of a Table View cell. After some trying I settled on a “pixel guide”: a pixel-sized empty image sitting right in the center of a cell, with label balanced equally to its sides. Works fine.

Again, not quite sure on this heavy black background for the due/deadline label, but I have an idea that I’m going to try tomorrow.

Feeling like a total noob every day!

 No comments   2014   Coursera Due   iOS
Earlier Ctrl + ↓