Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here first I am showing two functions, Whether these functions can be reduced to one something shown at bottom because both Boss and Employee are NSManagedObject.
- -(void)configureCell:(Boss *)bossObject
- {
- self.BackgroundImage.image = [UIImage imageWithData:bossObject.image];
- self.boss = bossObject;
- UIImage *backgroundImage;
- if (self.boss.completedStatus)
- {
- backgroundImage = [self completedBackgroundImage];
- }
- else
- {
- backgroundImage = [self defaultBackgroundImage];
- }
- self.cellBackgroundImage.image = backgroundImage;
- }
- -(void)configureCell:(Employee *)employeeObject
- {
- self.BackgroundImage.image = [UIImage imageWithData:employeeObject.image];
- self.employee = employeeObject;
- UIImage *backgroundImage;
- if (self.employee.completedStatus)
- {
- backgroundImage = [self completedBackgroundImage];
- }
- else
- {
- backgroundImage = [self defaultBackgroundImage];
- }
- self.cellBackgroundImage.image = backgroundImage;
- }
- Instead of writing these two separate functions, To reduce the duplication of code, can only one function be written some thing like this
- -(void)configureCell:(NSManagedObject *)Object
- {
- But here I dont know how to access the completion status here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement