UITapGestureRecognizer not working, Objective-C - ios

I apologize for asking this question for the millionth time, I've read the other questions asking the same thing and I couldn't find the answer to my problem!
I made a UITapGestureRecognizer that is just not working, can someone take a look at my code and tell me what I'm doing wrong?
-(void) formatCellForY: (CGFloat) y{
CGRect screen = [[UIScreen mainScreen] bounds];
CGFloat cellHeight = 70;
self.cell = [[UIImageView alloc] initWithImage:[UIImage imageNamed: #"Cell"]];
[self.cell setFrame:CGRectMake(20, y, screen.size.width - 40, cellHeight)];
self.cell.backgroundColor = [UIColor grayColor];
self.cell.userInteractionEnabled = YES;
self.cell.layer.shadowColor = [UIColor blackColor].CGColor;
self.cell.layer.shadowOffset = CGSizeMake(0, 1);
self.cell.layer.shadowOpacity = 1.0;
self.cell.layer.shadowRadius = 1.0;
self.cell.layer.cornerRadius = 1.0;
self.cell.clipsToBounds = NO;
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 5, self.cell.frame.size.width - 40, cellHeight*(.4))];
titleLabel.numberOfLines = 32;
titleLabel.text = self.program.programName;
titleLabel.textColor = [UIColor whiteColor];
titleLabel.userInteractionEnabled = YES;
[self.cell addSubview:titleLabel];
UILabel *explanationLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, titleLabel.frame.origin.y + titleLabel.frame.size.height, titleLabel.frame.size.width, cellHeight - (titleLabel.frame.origin.y+ titleLabel.frame.size.height))];
explanationLabel.text = self.program.programDescription;
explanationLabel.numberOfLines = 3;
explanationLabel.textColor = [UIColor whiteColor];
explanationLabel.font = [UIFont systemFontOfSize:10.0];
explanationLabel.userInteractionEnabled = YES;
[self.cell addSubview:explanationLabel];
self.tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(goToInfoPage:)];
self.tap.numberOfTapsRequired = 1;
self.tap.numberOfTouchesRequired = 1;
self.tap.enabled = YES;
[self.cell addGestureRecognizer:self.tap];
NSLog(#"%#", self.tap);
}
Here is the code I used to add the cell to the screen.
for (CKRecord *record in records) {
SBHProgram *program = [SBHProgram programForRecord:record];
SBHCell *cell = [SBHCell cellForProgram:program andY:90*i];
i++;
[scrollView addSubview:cell.cell];
}

You have missed adding self.cell to view. You are able to see labels with texts because you have added self.cell.clipsToBounds = NO;
All you have to do is add cell to view.
[self.view addSubview:self.cell]

PLEASE ADD
self.tap.delegate = self;

Related

Adding a tag to UIImageView

I have an array of an object (which contains an image and some text) and when I iterate around the array and add the image to a UIImageView (which is then added to a UIScrollView) all works well and each image is added with a specific UIImageView to the UIScrollView.
However as soon as I add a tag to the UIImageView not all the images are rendered within the added UIImageView (which is in the UIScrollView (some are missing, some are visible).
If I remove the tag, all works well? Is there something with tags I'm not grasping? Any help much appreciated.
for (Article *al in articleLists){
CGRect frame;
frame.origin.x = self.FeaturedView.frame.size.width * counter;
frame.origin.y = 0;
frame.size = self.FeaturedView.frame.size;
CGRect frameTextArea;
frameTextArea.origin.x = self.FeaturedView.frame.size.width * counter;
frameTextArea.origin.y = (self.FeaturedView.frame.size.height / 2) + 10;
frameTextArea.size.width = self.FeaturedView.frame.size.width;
frameTextArea.size.height = (self.FeaturedView.frame.size.height / 2) - 20;
CGRect frameTextLabel;
frameTextLabel.origin.x = (self.FeaturedView.frame.size.width * counter) + 20;
frameTextLabel.origin.y = (self.FeaturedView.frame.size.height / 2) + 10;
frameTextLabel.size.width = self.FeaturedView.frame.size.width - 40;
frameTextLabel.size.height = (self.FeaturedView.frame.size.height / 2) - 20;
if (al.imageURL != NULL){
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
imageView.contentMode = UIViewContentModeScaleAspectFill;
//imageView.tag = counter;
imageView.image = al.imageArticle;
UITapGestureRecognizer *imageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(singleTapGestureCaptured:)];
[imageView addGestureRecognizer:imageTap];
imageView.userInteractionEnabled = YES;
UIView *viewTextArea = [[UIView alloc]initWithFrame:frameTextArea];
viewTextArea.backgroundColor = [UIColor blackColor];
viewTextArea.alpha = 0.9;
UILabel *textLabel = [[UILabel alloc] initWithFrame:frameTextLabel];
textLabel.textColor = [UIColor whiteColor];
textLabel.backgroundColor = [UIColor clearColor];
textLabel.numberOfLines = 2;
textLabel.font = [UIFont fontWithName:#"Droid Sans" size:18];
textLabel.text = [al.currentTitle uppercaseString];
[self.FeaturedView addSubview:imageView];
[self.FeaturedView addSubview:viewTextArea];
[self.FeaturedView addSubview:textLabel];
}
else{
//UIImage *image = [UIImage imageNamed:#"ArticlePlaceholder.png"];
}
counter++;
}

iOS Image View turn off selection highlighting

Bit of a strange question, so i've attached a screen recording to help...
Video : https://www.dropbox.com/s/3aaefixsk8eejln/Error.mov (See past the watermark!)
My issue is that in my application when the user is at the "Preview" view and is reviewing their images, each time the image is selected, the image receives a touched overlay, which could be confusing for a user as nothing happens when touched.
I would like to disable this if possible..
Below is the example code to how the images are being displayed..
- (void)setReviewImages
{
continueButtonDisabled = YES;
downloadedImageCount = 0;
NSArray *reviewViews = scrollView.subviews;
for (IMReviewView *reviewView in reviewViews) {
[reviewView removeFromSuperview];
}
NSUInteger photoCount = [[IMLocalUser localUser] cachedPhotoCount];
if ( nPageNum == 0 ){
for (NSUInteger i = 0; i < photoCount; i++) {
CGRect frame;
frame.origin.x = scrollView.frame.size.width * i;
frame.origin.y = 65;
frame.size = CGSizeMake(scrollView.frame.size.width, 327.0f);
IMReviewView *subview = [[IMReviewView alloc] initWithFrame:frame];
subview.delegate = self;
subview.photo = [[IMLocalUser localUser] cachedPhotoAtIndex:i];
[scrollView addSubview:subview];
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * i, scrollView.frame.size.height);
UILabel *headingLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 20, 300, 30)];
[self.view addSubview:headingLabel];
headingLabel.text = #"Time To Preview!";
headingLabel.textColor = [UIColor blackColor];
headingLabel.textAlignment = UITextAlignmentCenter;
headingLabel.textAlignment = NSTextAlignmentCenter;
headingLabel.tag = 10;
headingLabel.backgroundColor = [UIColor clearColor];
headingLabel.font = [UIFont boldSystemFontOfSize:26.0f];
headingLabel.hidden = NO;
headingLabel.highlighted = YES;
headingLabel.highlightedTextColor = [UIColor blackColor];
headingLabel.lineBreakMode = YES;
headingLabel.numberOfLines = 0;
}
It seems to me like IMReviewView has a UIButton subview. If so, try to set its adjustsImageWhenHighlighted property to NO.

Autoresize UIScrollView To Fit UILabel Text

I have been searching for quite a while now, and every answer I find doesn't seem to work. I have a view, code below, that holds a bunch of text that is pulled from a YouTube video description from another view. Obviously ever video's descriptions are of different length, which is what poses the problem. I want to make it that the scrollview only scrolls down to about 10 pixels after the last text line of the label.
In this code, I don't have it doing that, I have it at a fixed size.
Can ANYONE help? I have been searching for days now, and I can seem to find a proper solution.
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
VideoDescription = [VideoDescription stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
//int a = VideoDescription.length;
//NSLog([NSString stringWithFormat:#"%i", a]);
if(VideoDescription.length < 310)
{
VideoDescription = [VideoDescription stringByAppendingString:#"\n_______________________________________________"];
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nFor the best viewing experience, please use WiFi."];
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nWant an app like this for your YouTube Channel? Go to www.apps4tubers.com to find out how you can get one!"];
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nDon't forget to rate this app! Love it? Hate it? Regardless we love to hear your comments and suggestions!"];
}
else if(VideoDescription.length < 380)
{
VideoDescription = [VideoDescription stringByAppendingString:#"\n_______________________________________________"];
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nFor the best viewing experience, please use WiFi."];
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nWant an app like this for your YouTube Channel? Go to www.apps4tubers.com to find out how you can get one!"];
}
else if(VideoDescription.length > 379 && VideoDescription.length < 410)
{
VideoDescription = [VideoDescription stringByAppendingString:#"\n_______________________________________________"];
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nWant an app like this for your YouTube Channel? Go to www.apps4tubers.com to find out how you can get one!"];
}
else
{
VideoDescription = [VideoDescription stringByAppendingString:#"\n\nFor the best viewing experience, please use WiFi."];
}
CGRect scrollViewFrame = CGRectMake(0, 0, 320, 480);
TheView = [[UIScrollView alloc] initWithFrame:scrollViewFrame];
CGSize scrollViewContentSize = CGSizeMake(320, 650);
[TheView setContentSize:scrollViewContentSize];
[TheView setPagingEnabled:NO];
TheView.showsHorizontalScrollIndicator = NO;
TheView.showsVerticalScrollIndicator = YES;
TheView.bounces = NO;
[self.view addSubview:TheView];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:#"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
Background = [[UILabel alloc] initWithFrame: CGRectMake(00, 25, 1000, 1600)];
Background.center = CGPointMake(00, 00);
Background.backgroundColor = [self colorWithHexString:#"111625"];
[TheView addSubview: Background];
VideoDecrip = [[UILabel alloc] initWithFrame: CGRectMake(00, 25, 320, 400)];
VideoDecrip.center = CGPointMake(160.5, 400);
VideoDecrip.text = VideoDescription;
VideoDecrip.font = [UIFont fontWithName: #"Cochin-Bold" size: 13.5];
VideoDecrip.textColor = [self colorWithHexString:#"D1E751"];
VideoDecrip.shadowColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.35];
VideoDecrip.layer.shadowOpacity = 0;
VideoDecrip.shadowOffset = CGSizeMake(1,1);
VideoDecrip.layer.masksToBounds = NO;
VideoDecrip.backgroundColor = [UIColor clearColor];
VideoDecrip.textAlignment = NSLineBreakByWordWrapping;
VideoDecrip.adjustsFontSizeToFitWidth = YES;
VideoDecrip.numberOfLines = 0;
[VideoDecrip sizeToFit];
[TheView addSubview: VideoDecrip];
NSLog(#"%i", VideoDecrip.text.length);
VideoTitleBorder = [[UILabel alloc] initWithFrame: CGRectMake(00, 25, 320.5, 30)];
VideoTitleBorder.center = CGPointMake(160, 182.5);
VideoTitleBorder.shadowOffset = CGSizeMake(1,1);
VideoTitleBorder.backgroundColor = [self colorWithHexString:#"0B486B"];
VideoTitleBorder.layer.borderColor = [UIColor darkGrayColor].CGColor;
VideoTitleBorder.layer.borderWidth = .4;
[TheView addSubview: VideoTitleBorder];
VideoTitle = [[UILabel alloc] initWithFrame: CGRectMake(00, 25, 320, 26)];
VideoTitle.text = VidTitle;
if([VideoTitle.text length] < 20)
{
VideoTitle.center = CGPointMake(160, 182.5);
}
else if([VideoTitle.text length] < 30)
{
VideoTitle.center = CGPointMake(160, 182);
}
else
{
VideoTitle.center = CGPointMake(160, 179);
}
VideoTitle.font = [UIFont fontWithName: #"ArialRoundedMTBold" size: 25];
VideoTitle.textColor = [self colorWithHexString:#"BEF202"];
VideoTitle.shadowColor = [UIColor blackColor];
VideoTitle.backgroundColor = [UIColor clearColor];
VideoTitle.shadowOffset = CGSizeMake(1,1);
VideoTitle.textAlignment = NSTextAlignmentCenter;
VideoTitle.adjustsFontSizeToFitWidth = YES;
[TheView addSubview: VideoTitle];
VideoTitleBorder2 = [[UILabel alloc] initWithFrame: CGRectMake(00, 25, 160, 500)];
VideoTitleBorder2.center = CGPointMake(400, 125);
VideoTitleBorder2.shadowOffset = CGSizeMake(1,1);
VideoTitleBorder2.backgroundColor = [self colorWithHexString:#"0B486B"];
VideoTitleBorder2.layer.borderColor = [UIColor darkGrayColor].CGColor;
VideoTitleBorder2.layer.borderWidth = 2.0;
[self.view addSubview: VideoTitleBorder2];
In short, you can use the NSString method -sizeWithFont:forWidth:lineBreakMode: to determine how tall the string will render in a container with the given width and line break mode. You can use that to size your UILabel and to set the scrollview's contentsize appropriately.
Try using sizeToFiton the label, then setting the scrollView's contentSize:
[label sizeToFit];
[scrollView setContentSize:CGSizeMake(CGRectGetWidth(self.view.frame), CGRectGetHeight(label.frame) + 10)];
Using sizeToFit is really nice, just make sure your label is already the right width before you call it.

iOS - Reuseable UIView Subclass

I am trying to build a few different UIView subclasses to display information to my app users.
One problem I am having is being able to call the view more than once.
Here is the testing call:
if(rewardsView==nil){
rewardsView = [[RewardsView alloc] init];
[rewardsView showRewardType:RewardsAttack withXP:100 withZBucks:10 isCritical:NO];
}else{
[rewardsView showRewardType:RewardsAttack withXP:200 withZBucks:20 isCritical:NO];
}
Here is the Code to initialize and display:
- (id)init
{
self = [super init];
if (self) {
// Initialization code
self.frame = CGRectMake(0, 0, DEVICE_WIDTH, DEVICE_HEIGHT);
//Z-Bucks
zBucksIcon = [UIImage imageNamed:#"rewards-z-bucks"];
zBucksView = [[UIImageView alloc] initWithFrame:CGRectMake(DEVICE_WIDTH/4-zBucksIcon.size.width/2, DEVICE_HEIGHT/2-zBucksIcon.size.height/2-12, zBucksIcon.size.width, zBucksIcon.size.height+25)];
[zBucksView setImage:zBucksIcon];
zBucksView.alpha = 0;
zBucksLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, zBucksIcon.size.height, zBucksIcon.size.width,25)];
zBucksLabel.backgroundColor = [UIColor clearColor];
zBucksLabel.textAlignment = NSTextAlignmentCenter;
zBucksLabel.font = [UIFont fontWithName:#"Open Sans Condensed" size:24];
zBucksLabel.textColor = [UIColor whiteColor];
zBucksLabel.shadowColor = [UIColor blackColor];
zBucksLabel.shadowOffset = CGSizeMake(1, 1);
[zBucksView addSubview:zBucksLabel];
//XP
xpIcon = [UIImage imageNamed:#"rewards-xp"];
xpView = [[UIImageView alloc] initWithFrame:CGRectMake(DEVICE_WIDTH/4*3-xpIcon.size.width/2, DEVICE_HEIGHT/2-xpIcon.size.height/2-12, xpIcon.size.width, xpIcon.size.height+25)];
[xpView setImage:xpIcon];
xpLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, xpIcon.size.height, xpIcon.size.width,25)];
xpLabel.backgroundColor = [UIColor clearColor];
xpLabel.textAlignment = NSTextAlignmentCenter;
xpLabel.font = [UIFont fontWithName:#"Open Sans Condensed" size:24];
xpLabel.textColor = [UIColor blackColor];
xpLabel.shadowColor = [UIColor whiteColor];
xpLabel.shadowOffset = CGSizeMake(1, 1);
[xpView addSubview:xpLabel];
xpView.alpha = 0;
[self addSubview:zBucksView];
[self addSubview:xpView];
}
return self;
}
-(void)showRewardType:(RewardsType)type withXP:(int)xp withZBucks:(int)zBucks isCritical:(BOOL)critical{
//Set Values
zBucksLabel.text = [NSString stringWithFormat:#"+%i",zBucks];
xpLabel.text = [NSString stringWithFormat:#"+%i",xp];
if(type==RewardsAttack){
}
if(type==RewardsHeal){
}
if(type==RewardsDaily){
}
UIWindow *window = [appDelegate window];
[window addSubview:self];
[self animateRewards];
}
Here is the code that dismisses (after some animation functions are called, not shown here):
-(void)dismissRewards{
[self removeFromSuperview];
//Reset Views
zBucksView.alpha = 0;
xpView.alpha = 0;
[zBucksView setFrame:CGRectMake(DEVICE_WIDTH/4-zBucksIcon.size.width/2, DEVICE_HEIGHT/2-zBucksIcon.size.height/2-12, zBucksIcon.size.width, zBucksIcon.size.height+25)];
[xpView setFrame:CGRectMake(DEVICE_WIDTH/4*3-xpIcon.size.width/2, DEVICE_HEIGHT/2-xpIcon.size.height/2-12, xpIcon.size.width, xpIcon.size.height+25)];
}

Slow loading tableview on iPhone with reusable cells

I load the data from Parse.com backend, they send me a solutions for use the reusable cells but now I still have troubles with the loading speed, this is the coding I have in my tableview and I have a Subclass for making up my cells (ExploreStreamCustomCell.m)
- (ExploreStreamCustomCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
object:(PFObject *)object
{
static NSString *CellIdentifier = #"ExploreStreamCustomCell";
ExploreStreamCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[ExploreStreamCustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier];
}
// Configure the cell
cell.listItemTitle.text = [object objectForKey:#"text"];
cell.checkinsLabel.text = [NSString stringWithFormat:#"%#", [object objectForKey:#"checkins"]];
cell.descriptionLabel.text = [object objectForKey:#"description"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
PFFile *listThumbnail = [object objectForKey:#"header"];
cell.listViewImage.image = [UIImage imageNamed:#"loading_image_stream.png"]; // placeholder image
cell.listViewImage.file = listThumbnail;
[cell.listViewImage loadInBackground:NULL];
return cell;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForNextPageAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [super tableView:tableView cellForNextPageAtIndexPath:indexPath];
cell.textLabel.font = [cell.textLabel.font fontWithSize:kPAWWallPostTableViewFontSize];
return cell;
}
If I have all the content of the //configure cell in the cell == nil the it's fast but it show up 3 of the 9 unique datarows and repeat those 3 unique content cell 3 times?
Edit extra code within ExploreStreamCustomCell.m
#import "ExploreStreamCustomCell.h"
#implementation ExploreStreamCustomCell
#synthesize listViewImage,
iconLocation,
iconPeople,
iconCheckins,
listItemTitle,
locationLabel,
peopleLabel,
checkinsLabel,
descriptionLabel,
listItemView;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
//Initialization code
listItemView = [[UIView alloc] init];
listViewImage = [[PFImageView alloc] init];
iconLocation = [[UIImageView alloc] init];
iconPeople = [[UIImageView alloc] init];
iconCheckins = [[UIImageView alloc] init];
listItemTitle = [[UILabel alloc] init];
locationLabel = [[UILabel alloc] init];
peopleLabel = [[UILabel alloc] init];
checkinsLabel = [[UILabel alloc] init];
descriptionLabel = [[UILabel alloc] init];
listViewImage.image = [UIImage imageNamed:#"nachtwacht_list_formaat.png"];
iconLocation.image = [UIImage imageNamed:#"icon_magenta_location.png"];
iconPeople.image = [UIImage imageNamed:#"icon_magenta_people.png"];
iconCheckins.image = [UIImage imageNamed:#"icon_magenta_checkins.png"];
listItemTitle.text = #"text";
locationLabel.text = #"0,7 km";
peopleLabel.text = #"34";
checkinsLabel.text = #"61";
descriptionLabel.text = #"Description text.";
[self.contentView addSubview:listItemView];
[self.contentView addSubview:listViewImage];
[self.contentView addSubview:iconLocation];
[self.contentView addSubview:iconPeople];
[self.contentView addSubview:iconCheckins];
[self.contentView addSubview:listItemTitle];
[self.contentView addSubview:locationLabel];
[self.contentView addSubview:peopleLabel];
[self.contentView addSubview:checkinsLabel];
[self.contentView addSubview:descriptionLabel];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
CGRect contentRect = self.contentView.bounds;
CGFloat boundsX = contentRect.origin.x;
CGRect frame;
frame= CGRectMake(boundsX+0 , 33, 280, 124);
listViewImage.frame = frame;
listViewImage.contentMode = UIViewContentModeScaleAspectFill;
listViewImage.layer.masksToBounds = YES;
//listViewImage.backgroundColor = [UIColor lightGrayColor];
frame= CGRectMake(boundsX+20 , 164, 12, 18);
iconLocation.frame = frame;
//iconLocation.backgroundColor = [UIColor lightGrayColor];
frame= CGRectMake(boundsX+102 , 164, 24, 18);
iconPeople.frame = frame;
//iconPeople.backgroundColor = [UIColor lightGrayColor];
frame= CGRectMake(boundsX+193 , 164, 20, 16);
iconCheckins.frame = frame;
//iconLocation.backgroundColor = [UIColor lightGrayColor];
frame= CGRectMake(boundsX+0 , 0, 280, 33);
listItemView.frame = frame;
listItemView.backgroundColor = [UIColor colorWithRed:0.749 green:0.000 blue:0.243 alpha:1.000];
frame= CGRectMake(boundsX+20 , 3, 240, 29);
listItemTitle.frame = frame;
//listItemTitle.textColor = [UIColor colorWithRed:250.0f/255.0f green:194.0f/255.0f blue:9.0f/255.0f alpha:0.8f];
listItemTitle.textAlignment = UITextAlignmentLeft;
listItemTitle.font = [UIFont boldSystemFontOfSize:15];
listItemTitle.textColor = [UIColor whiteColor];
listItemTitle.backgroundColor = [UIColor clearColor];
listItemTitle.lineBreakMode = UILineBreakModeTailTruncation;
//listItemTitle.backgroundColor = [UIColor orangeColor];
frame= CGRectMake(boundsX+40 , 164, 57, 21);
locationLabel.frame = frame;
locationLabel.textAlignment = UITextAlignmentLeft;
locationLabel.font = [UIFont boldSystemFontOfSize:12];
locationLabel.textColor = [UIColor colorWithRed:0.749 green:0.000 blue:0.243 alpha:1.000];
locationLabel.backgroundColor = [UIColor clearColor];
locationLabel.lineBreakMode = UILineBreakModeTailTruncation;
locationLabel.numberOfLines = 1;
//locationLabel.backgroundColor = [UIColor redColor];
frame= CGRectMake(boundsX+134 , 164, 57, 21);
peopleLabel.frame = frame;
peopleLabel.textAlignment = UITextAlignmentLeft;
peopleLabel.font = [UIFont boldSystemFontOfSize:12];
peopleLabel.textColor = [UIColor colorWithRed:0.749 green:0.000 blue:0.243 alpha:1.000];
peopleLabel.backgroundColor = [UIColor clearColor];
peopleLabel.lineBreakMode = UILineBreakModeTailTruncation;
peopleLabel.numberOfLines = 1;
frame= CGRectMake(boundsX+221 , 164, 51, 21);
checkinsLabel.frame = frame;
checkinsLabel.textAlignment = UITextAlignmentLeft;
checkinsLabel.font = [UIFont boldSystemFontOfSize:12];
checkinsLabel.textColor = [UIColor colorWithRed:0.749 green:0.000 blue:0.243 alpha:1.000];
checkinsLabel.backgroundColor = [UIColor clearColor];
checkinsLabel.lineBreakMode = UILineBreakModeTailTruncation;
checkinsLabel.numberOfLines = 1;
frame= CGRectMake(boundsX+0 , 189, 280, 55);
descriptionLabel.frame = frame;
descriptionLabel.textAlignment = UITextAlignmentLeft;
descriptionLabel.font = [UIFont systemFontOfSize:13];
descriptionLabel.backgroundColor = [UIColor clearColor];
descriptionLabel.lineBreakMode = UILineBreakModeTailTruncation;
descriptionLabel.numberOfLines = 3;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
/*
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
#end
A great way to explore the inefficiencies of your code is to use Instruments' Time Profiler tool. The Time Profiler will let you see how much time is being spent on each task, line-by-line in your code.
I would recommend the following settings for profiling:
From Apple's Face Detection sample app:
You can then double click any line (higher percentages mean more time is being devoted to that method call) to see in the code how much time is spent in each place.
From here you can begin to figure out where you are being inefficient and see exactly what is taking up so much time. Good luck!

Resources