Commit d9a6231b authored by admin's avatar admin

修复bug

parent 0bc0698d
......@@ -43,6 +43,8 @@
- (void)setAnnoDetail:(AnnounceDetailModel *)annoDetail
{
_annoDetail = annoDetail;
self.titleLabel.text = [NSString stringWithFormat:@"%@", _annoDetail.title];
self.nameLabel.text = [NSString stringWithFormat:@"%@", _annoDetail.lastModify_operName];
self.timeLabel.text = [NSString stringWithFormat:@"%@", _annoDetail.lastModify_time];
......
......@@ -115,7 +115,11 @@
cell = [[AnnoContentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAnnounceContentCell];
}
cell.titleLabel.text = @"内容";
cell.contentLabel.text = [NSString stringWithFormat:@"%@",_annoDetail.content];
NSString *str = [NSString stringWithFormat:@"<style> html{ font-size: 15px; color: #444444 } </style>%@", _annoDetail.content];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
cell.contentLabel.attributedText = attrStr;
cell.backgroundColor = kAnnounceHeaderColor;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
......
......@@ -13,7 +13,14 @@
- (void)setAnnounce:(AnnounceModel *)announce
{
_announce = announce;
self.titleLabel.text = [NSString stringWithFormat:@"%@", announce.content];
NSString *str = [NSString stringWithFormat:@"<style> html{ font-size: 15px; color: #444444 } </style>%@", announce.content];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
self.titleLabel.attributedText = attrStr;
//self.titleLabel.text = [NSString stringWithFormat:@"%@", announce.content];
self.peopleLabel.text = [NSString stringWithFormat:@"发布人:%@ 发布日期:%@", announce.lastModify_operName ,announce.lastModify_time];
if ([self.currentState isEqualToString:@"false"]) {
......
......@@ -43,7 +43,7 @@
self.allAnnoArray = [NSMutableArray array];
self.isRead = NO;
self.stateStr = @"0";
self.stateStr = @"false";
[self setNav];
......@@ -70,7 +70,7 @@
int page_number = 0;
int page_size = 10;
NSString *url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
//NSString *url = [NSString stringWithFormat:@"%@%@%@?page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid, page_number, page_size];
// NSString *url = [NSString stringWithFormat:@"%@%@%@?page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid, page_number, page_size];
NSLog(@"urlll = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
......@@ -123,15 +123,16 @@
- (void)segmentChangedValue:(UISegmentedControl *)sender
{
NSString *url;
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
int page_number = 0;
int page_size = 10;
if (sender.selectedSegmentIndex == 0) {
self.stateStr = @"0";
self.stateStr = @"false";
url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
} else if (sender.selectedSegmentIndex == 1) {
self.stateStr = @"1";
self.stateStr = @"true";
url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
} else {
self.stateStr = @"";
......
......@@ -469,8 +469,8 @@
NSLog(@"imageName = %@", imageName);
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSLog(@"image = %@fullPath = %@", image, fullPath);
[cell.photoButton1 setImage:image forState:UIControlStateNormal];
UIImage *image00 = [self cutImage:image];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
cell.photoButton2.tag = 2201;
[cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
......@@ -498,18 +498,17 @@
cell = [[InpectPictureCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
NSString *imageName0 = _imageNameArray[(indexPath.row - 3) * 2];
NSLog(@"imageName = %@", imageName0);
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
NSLog(@"image = %@fullPath = %@", image0, fullPath0);
[cell.photoButton1 setImage:image0 forState:UIControlStateNormal];
UIImage *image00 = [self cutImage:image0];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 3) * 2 + 1];
NSLog(@"imageName = %@", imageName1);
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
NSLog(@"image = %@fullPath = %@", image1, fullPath1);
[cell.photoButton2 setImage:image1 forState:UIControlStateNormal];
UIImage *image11 = [self cutImage:image1];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
return cell;
}
......@@ -517,6 +516,29 @@
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
......
......@@ -38,6 +38,7 @@
[questionNameAttr addAttributes:@{NSForegroundColorAttributeName:kdetailCellTitleColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(5,questionNameText.length - 5)];
[self.questionName setAttributedText:questionNameAttr];
NSLog(@"questionDetail.state = %@",questionDetail.state);
// 状态
if ([questionDetail.state isEqualToString:@"resolved"]) {
NSString *stateText = [NSString stringWithFormat:@"状态:已解决"];
......
......@@ -70,7 +70,7 @@
[self setupNav];
[self requestQuestionList];
// [self requestQuestionList];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(requestQuestionList)
......@@ -91,6 +91,8 @@
[self.menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[self.menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
self.tabBarController.tabBar.hidden = YES;
[self requestQuestionList];
}
......
......@@ -181,8 +181,10 @@
NSLog(@"imageName = %@", imageName);
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
NSLog(@"image = %@fullPath = %@", image, fullPath);
[cell.photoButton1 setImage:image forState:UIControlStateNormal];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
cell.photoButton2.tag = 2201;
[cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
......@@ -210,22 +212,107 @@
cell = [[InpectPictureCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
NSString *imageName0 = _imageNameArray[(indexPath.row - 1) * 2];
NSLog(@"imageName = %@", imageName0);
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
NSLog(@"image = %@fullPath = %@", image0, fullPath0);
[cell.photoButton1 setImage:image0 forState:UIControlStateNormal];
UIImage *image00 = [self cutImage:image0];
// UIImage *image00 = [self getSubImage:image0 mCGRect:CGRectMake(0, 0, (kScreenWidth - 20 * 3) / 2, 90) centerBool:YES];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 1) * 2 + 1];
NSLog(@"imageName = %@", imageName1);
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
NSLog(@"image = %@fullPath = %@", image1, fullPath1);
[cell.photoButton2 setImage:image1 forState:UIControlStateNormal];
UIImage *image11 = [self cutImage:image1];
// UIImage *image11 = [self getSubImage:image1 mCGRect:CGRectMake(0, 0, (kScreenWidth - 20 * 3) / 2, 90) centerBool:YES];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
return cell;
}
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
- (UIImage*)getSubImage:(UIImage *)image mCGRect:(CGRect)mCGRect centerBool:(BOOL)centerBool
{
/*如若centerBool为Yes则是由中心点取mCGRect范围的图片*/
float imgwidth = image.size.width;
float imgheight = image.size.height;
float viewwidth = mCGRect.size.width;
float viewheight = mCGRect.size.height;
CGRect rect;
if(centerBool)
rect = CGRectMake((imgwidth-viewwidth)/2, (imgheight-viewheight)/2, viewwidth, viewheight);
else{
if (viewheight < viewwidth) {
if (imgwidth <= imgheight) {
rect = CGRectMake(0, 0, imgwidth, imgwidth*viewheight/viewwidth);
}else {
float width = viewwidth*imgheight/viewheight;
float x = (imgwidth - width)/2 ;
if (x > 0) {
rect = CGRectMake(x, 0, width, imgheight);
}else {
rect = CGRectMake(0, 0, imgwidth, imgwidth*viewheight/viewwidth);
}
}
}else {
if (imgwidth <= imgheight) {
float height = viewheight*imgwidth/viewwidth;
if (height < imgheight) {
rect = CGRectMake(0, 0, imgwidth, height);
}else {
rect = CGRectMake(0, 0, viewwidth*imgheight/viewheight, imgheight);
}
}else {
float width = viewwidth*imgheight/viewheight;
if (width < imgwidth) {
float x = (imgwidth - width)/2 ;
rect = CGRectMake(x, 0, width, imgheight);
}else {
rect = CGRectMake(0, 0, imgwidth, imgheight);
}
}
}
}
CGImageRef subImageRef = CGImageCreateWithImageInRect(image.CGImage, rect);
CGRect smallBounds = CGRectMake(0, 0, CGImageGetWidth(subImageRef), CGImageGetHeight(subImageRef));
UIGraphicsBeginImageContext(smallBounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawImage(context, smallBounds, subImageRef);
UIImage* smallImage = [UIImage imageWithCGImage:subImageRef];
UIGraphicsEndImageContext();
return smallImage;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
......
......@@ -50,7 +50,6 @@
self.loginView.usernameTextFiled.delegate = self;
self.loginView.passwordTextFiled.delegate = self;
// 初始化数组
self.allUserDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"thoradmin", @"admin", nil];
[self requestLogin];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment