11th Day As An iOS Developer With No Experience

September 17, 2015 - 11th Day As An iOS Developer With No Experience

Thursday - Have I mentioned already in my past posts that I’m starting to have my self confidence, confidence that I will be able to finish the project before or on the deadline? Oh and I just realised that September 25 - my deadline - is actually a holiday in my country. I asked my project manager if the deadline will be moved to Monday instead, 28th of September. He answered me No. What the heck? Sir, you really are overestimating my power. lol. You see, I don’t have much enough knowledge to finish the project on Thursday next week. But I’m letting the Lord handle this, I will do my best and our God will do the rest. Amen!

I have made a big progress in my project. I can now see hope, yes! Thank you Lord! So let’s go to the technical part of software development:

I have successfully added some spaces in my UITableView’s cells. I’m not quite sure if I mentioned in my yesterday post that I was struggling in adding spaces to the cells, and it was time consuming, in fact I’ve spent so much time like 8 hours or so (what the heck, right?) in solving the problem. So what did I do to solve the spacing? We have the following steps to put some spaces to the cells WITH IMAGE, in my case I have 1 image per cell. Check out your iOS (iPhone’s or iPad’s) Gallery App, and specifically the Albums, you can see some spaces right?

  1. Subclass the UITableViewCell - quite long process, I mean short but quite long. Lol. Sorry for the confusion. You have to add new class files choosing UITableViewCell as the super class, and you’re gonna have to put a bit of coding to that class.
  2. OR you can add another cell, and then you’re gonna deal, in this case, with logics and algorithm.
  3. Lastly, this is the technique that I did: deal with indexPath.section of the cell instead of indexPath.row, see this solution:
#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    return self.groups.count;

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    return 1;

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    return 10.0f;

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
    UIView *v = [UIView new];
    [v setBackgroundColor:[UIColor clearColor]];
    return v;

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    ALAssetsGroup *groupForCell = self.groups[indexPath.section];
    CGImageRef posterImageRef = [groupForCell posterImage];
    UIImage *posterImage = [UIImage imageWithCGImage:posterImageRef];
    cell.imageView.image = posterImage;
    cell.textLabel.text = [groupForCell valueForProperty:ALAssetsGroupPropertyName];
    cell.detailTextLabel.text = [@(groupForCell.numberOfAssets) stringValue];
    return cell;

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    return 80.0f;

For the easy read, check the answer of the user ‘Obaid”: http://stackoverflow.com/questions/7189523/how-to-give-space-between-two-cells-in-tableview

In continuation of my story for the day, I, together with the two senior developers in the office, and our CTO, went a fancy restaurant. Of course the generous CTO paid for our dinner and drinks. Thank you very kind sir! I’m looking forward to more progress. Fin.


Hope is real! God Bless!


Nice story and nice blog. Keep it up!


Post a Comment