// // SimpleGride.m // Apex Mobile // // Created by Ray on 14-3-4. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved. // #import "SimpleGrid.h" //#import "Constant.h" #import "RAUtils.h" #define COLOR(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A] @implementation SimpleGrid @synthesize griddelegate; - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } -(NSString *)flattenHTML:(NSString *)html trimWhiteSpace:(BOOL)trim { NSScanner *theScanner = [NSScanner scannerWithString:html]; NSString *text = nil; while ([theScanner isAtEnd] == NO) { // find start of tag [theScanner scanUpToString:@"<" intoString:NULL] ; // find end of tag [theScanner scanUpToString:@">" intoString:&text] ; // replace the found tag with a space //(you can filter multi-spaces out later if you wish) html = [html stringByReplacingOccurrencesOfString: [ NSString stringWithFormat:@"%@>", text] withString:@""]; } return trim ? [html stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] : html; } -(void) initgrid //:(PageData*) pageData { for(UIView* v in self.subviews) { if(v.tag==200)// do not remove refresh control; continue; [v removeFromSuperview]; } int column_count=[[self.header valueForKey:@"count"] intValue]; int row_count = [[self.data valueForKey:@"count"] intValue]; self.contentSize = CGSizeMake(0.0,0.0); // self.hrefs = [[NSMutableDictionary alloc] init]; // self.pageData = pageData; self.hidden = TRUE; // self.basetag = row_count*column_count; self.row_count = row_count; self.column_count = column_count; // self.fullrowselect = true; self.top_line = 2; self.left_line =2; self.right_line =2; self.bottom_line=2; self.line = 1; int columns_width[column_count] ; int row_offset = 20; int header_offset = 20; // int padding_top = 2; // int padding_bottom = 2; int background_margin = 15; int padding_h = 5; // int padding_v = 5; UILabel * compute_item = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0 )] ; for(int i=0;i