Skip to content

Commit

Permalink
fix small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hikui committed Apr 10, 2012
1 parent a02f45f commit 468ad24
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 21 deletions.
Binary file not shown.
Expand Up @@ -359,11 +359,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PicShareClient_iOS/BoardDetailViewController.m"
timestampString = "355483432.964923"
timestampString = "355765033.925634"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "165"
endingLineNumber = "165"
startingLineNumber = "164"
endingLineNumber = "164"
landmarkName = "@implementation BoardDetailViewController"
landmarkType = "3">
</FileBreakpoint>
Expand Down
Expand Up @@ -127,12 +127,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
[imgView4 addTarget:self action:@selector(picOnTouch:) forControlEvents:UIControlEventTouchUpInside];
cell.selectedBackgroundView.backgroundColor = [UIColor whiteColor];
}else {
do {
UIView *tmpView = [cell.contentView viewWithTag:FIRST_IMGVIEW_TAG];
if ([tmpView isKindOfClass:[PSThumbnailImageView class]]) {
imgView1 = (PSThumbnailImageView *) tmpView;
}
} while (imgView1 == nil);

UIView *tmpView = [cell.contentView viewWithTag:FIRST_IMGVIEW_TAG];
if ([tmpView isKindOfClass:[PSThumbnailImageView class]]) {
imgView1 = (PSThumbnailImageView *) tmpView;
}
imgView1 = (PSThumbnailImageView *)[cell.contentView viewWithTag:FIRST_IMGVIEW_TAG];
imgView2 = (PSThumbnailImageView *)[cell.contentView viewWithTag:SECOND_IMGVIEW_TAG];
imgView3 = (PSThumbnailImageView *)[cell.contentView viewWithTag:THIRD_IMGVIEW_TAG];
Expand Down Expand Up @@ -224,6 +223,7 @@ - (IBAction)avatarButtonOnTouch:(id)sender
{
UserDetailViewController *udvc = [[UserDetailViewController alloc]initWithUser:self.board.owner];
[self.navigationController pushViewController:udvc animated:YES];
[udvc release];
}
- (IBAction)followButtonOnTouch:(id)sender
{
Expand Down
Expand Up @@ -49,7 +49,7 @@ - (void)viewDidLoad
}else if(type==UPDATE){
self.boardNameTF.text = self.board.name;
}
UIBarButtonItem *rightItem;
UIBarButtonItem *rightItem = nil;
if (type==CREATE) {
rightItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(createToServer)];
self.title = @"新建相册";
Expand Down
Expand Up @@ -139,6 +139,7 @@ - (void)addButtonOnTouch
BoardInfoEditorViewController *bivec = [[BoardInfoEditorViewController alloc]initWithNibName:@"BoardInfoEditorViewController" bundle:nil];
bivec.type = CREATE;
[self.navigationController pushViewController:bivec animated:YES];
[bivec release];
}

- (void)setBoardIsSelectedBlock:(BoardIsSelectedBlock)_isSelectedBlock
Expand Down
15 changes: 8 additions & 7 deletions PicShareClient_iOS/PicShareClient_iOS/PicShareEngine.m
Expand Up @@ -13,7 +13,7 @@

#define UPLOAD_IMAGE 0

NSString *picshareDomain = @"http://localhost:8000/";
NSString *picshareDomain = @"http://picshare.herkuang.info:8000/";

@interface PicShareEngine ()

Expand Down Expand Up @@ -450,7 +450,7 @@ -(ErrorMessage *)followBoard:(NSInteger)boardId
}
if (response != nil) {
NSDictionary *dataDict = [response objectFromJSONString];
ErrorMessage *em = [[ErrorMessage alloc]initWithJSONDict:dataDict];
ErrorMessage *em = [[[ErrorMessage alloc]initWithJSONDict:dataDict]autorelease];
NSLog(@"errorMessage:%@",em);
return em;
}
Expand All @@ -475,7 +475,7 @@ -(ErrorMessage *)followUser:(NSInteger)userId
}
if (response != nil) {
NSDictionary *dataDict = [response objectFromJSONString];
ErrorMessage *em = [[ErrorMessage alloc]initWithJSONDict:dataDict];
ErrorMessage *em = [[[ErrorMessage alloc]initWithJSONDict:dataDict]autorelease];
NSLog(@"errorMessage:%@",em);
return em;
}
Expand All @@ -499,7 +499,7 @@ -(ErrorMessage *)unFollowBoard:(NSInteger)boardId
}
if (response != nil) {
NSDictionary *dataDict = [response objectFromJSONString];
ErrorMessage *em = [[ErrorMessage alloc]initWithJSONDict:dataDict];
ErrorMessage *em = [[[ErrorMessage alloc]initWithJSONDict:dataDict]autorelease];
NSLog(@"errorMessage:%@",em);
return em;
}
Expand All @@ -523,7 +523,7 @@ -(ErrorMessage *)unFollowUser:(NSInteger)userId
}
if (response != nil) {
NSDictionary *dataDict = [response objectFromJSONString];
ErrorMessage *em = [[ErrorMessage alloc]initWithJSONDict:dataDict];
ErrorMessage *em = [[[ErrorMessage alloc]initWithJSONDict:dataDict]autorelease];
NSLog(@"errorMessage:%@",em);
return em;
}
Expand All @@ -550,7 +550,7 @@ -(ErrorMessage *)updateBoard:(Board *)aBoard
}
if (response != nil) {
NSDictionary *dataDict = [response objectFromJSONString];
ErrorMessage *em = [[ErrorMessage alloc]initWithJSONDict:dataDict];
ErrorMessage *em = [[[ErrorMessage alloc]initWithJSONDict:dataDict]autorelease];
NSLog(@"errorMessage:%@",em);
return em;
}
Expand Down Expand Up @@ -611,14 +611,15 @@ -(PictureStatus *)repin:(NSInteger)ps_id toBoard:(NSInteger)boardId withDescript
}
if (response != nil) {
NSDictionary *dataDict = [response objectFromJSONString];
PictureStatus *ps = [[PictureStatus alloc]initWithJSONDict:dataDict];
PictureStatus *ps = [[[PictureStatus alloc]initWithJSONDict:dataDict]autorelease];
if (ps!=nil) {
return ps;
}else {
ErrorMessage *em = [[ErrorMessage alloc]initWithJSONDict:dataDict];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:em.errorMsg delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil];
[alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
[alert release];
[em release];
}
}
return nil;
Expand Down
1 change: 1 addition & 0 deletions PicShareClient_iOS/PicShareClient_iOS/TimelineCell.h
Expand Up @@ -26,6 +26,7 @@
@property (nonatomic,retain) UIButton *repinButton;
@property (nonatomic,retain) UITextField *commentTextField;
@property (nonatomic,retain) ASIHTTPRequest *request;
@property (nonatomic,retain) UILabel *viaLabel;

- (void)refreshWithPictureStatus:(PictureStatus *)aPictureStatus;

Expand Down
14 changes: 10 additions & 4 deletions PicShareClient_iOS/PicShareClient_iOS/TimelineCell.m
Expand Up @@ -20,7 +20,7 @@ @interface TimelineCell ()

@implementation TimelineCell

@synthesize avatarImageView,usernameButton,boardNameButton,picDescriptionLabel,mainImageView,repinButton,commentTextField,pictureStatus,viaButton,request;
@synthesize avatarImageView,usernameButton,boardNameButton,picDescriptionLabel,mainImageView,repinButton,commentTextField,pictureStatus,viaButton,request,viaLabel;

- (void)dealloc
{
Expand All @@ -34,6 +34,7 @@ - (void)dealloc
[repinButton release];
[commentTextField release];
[viaButton release];
[viaLabel release];
[super dealloc];
}

Expand All @@ -50,13 +51,15 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
repinButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect]retain];
commentTextField = [[UITextField alloc]init];
viaButton = [[UIButton buttonWithType:UIButtonTypeCustom]retain];
viaLabel = [[UILabel alloc]init];
[self.contentView addSubview:avatarImageView];
[self.contentView addSubview:usernameButton];
[self.contentView addSubview:boardNameButton];
[self.contentView addSubview:picDescriptionLabel];
[self.contentView addSubview:mainImageView];
[self.contentView addSubview:repinButton];
[self.contentView addSubview:viaButton];
[self.contentView addSubview:viaLabel];
}
return self;
}
Expand Down Expand Up @@ -97,11 +100,10 @@ - (void)layout

CGRect viaButtonFrame = CGRectMake(0, 0, 0, 0);
if (pictureStatus.via !=nil) {
UILabel *viaLabel = [[UILabel alloc]initWithFrame:CGRectMake(nameButtonFrame.origin.x, nameButtonFrame.origin.y+nameButtonSize.height+4, 35, 18)];
self.viaLabel.frame = CGRectMake(nameButtonFrame.origin.x, nameButtonFrame.origin.y+nameButtonSize.height+4, 35, 18);
viaLabel.font = [UIFont systemFontOfSize:14];
viaLabel.text = @"转自";
[self.contentView addSubview:viaLabel];
[viaLabel release];
[viaLabel setHidden:NO];

CGSize viaButtonSize = [pictureStatus.via.username sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(320-8-(viaLabel.frame.origin.x+viaLabel.frame.size.width), 18) lineBreakMode:UILineBreakModeTailTruncation];
viaButtonFrame = CGRectMake(viaLabel.frame.origin.x+viaLabel.frame.size.width+8, viaLabel.frame.origin.y, viaButtonSize.width, viaButtonSize.height);
Expand All @@ -111,7 +113,11 @@ - (void)layout
[viaButton setTitleColor:RGBA(93, 145, 166, 1) forState:UIControlStateNormal];
viaButton.titleLabel.font = [UIFont systemFontOfSize:14];
[viaButton setContentVerticalAlignment:UIControlContentHorizontalAlignmentLeft];
[viaButton setHidden:NO];

}else {
[viaButton setHidden:YES];
[viaLabel setHidden:YES];
}


Expand Down

0 comments on commit 468ad24

Please sign in to comment.