ipad开发,显示粗体。

xcode大部分组件不支持html,真是很麻烦,有说three20比较好,但是不能一个小功能就添加那么大一个库,没办法,自己瞎写了一个,有待日后完善。感觉objective-c和java c++还是很不同的。
NSString* rdes = matL.m_description;
	NSArray* subarray = [rdes componentsSeparatedByString:player.m_playername];
	UIView * des = [[UIView alloc]initWithFrame:CGRectMake(120, 0, 370, 50)];
	des.backgroundColor = [UIColor colorWithRed:41.0/255.0 green:41.0/255.0 blue:41.0/255.0 alpha:1.0];
	int widd = 0;
	for (int i=0; i<subarray.count;i++){
		NSString *d = [subarray objectAtIndex:i];
		if([d isEqual:@""])
		{
			UIFont *font = [UIFont boldSystemFontOfSize:14];
			CGSize size = CGSizeMake(320,2000);
			CGSize labelsize = [player.m_playername sizeWithFont:font constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
		UILabel* fname = [[UILabel alloc]initWithFrame:CGRectMake(widd, 0, labelsize.width, 50)];
		fname.text = [NSString stringWithFormat:@"%@",player.m_playername];	
		fname.textColor = [UIColor whiteColor];
		fname.backgroundColor = [UIColor colorWithRed:41.0/255.0 green:41.0/255.0 blue:41.0/255.0 alpha:1.0];
			

			fname.font = font;
			
		[des addSubview:fname];
		[fname release];
			widd +=labelsize.width;
		}
		else {
			UIFont *font = [UIFont systemFontOfSize:14];
			CGSize size = CGSizeMake(320,2000);
			CGSize labelsize = [d sizeWithFont:font constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
			UILabel* fname = [[UILabel alloc]initWithFrame:CGRectMake(widd, 0, labelsize.width, 50)];
			fname.text = [NSString stringWithFormat:@"%@",d];	
			fname.textColor = [UIColor whiteColor];
			fname.backgroundColor = [UIColor colorWithRed:41.0/255.0 green:41.0/255.0 blue:41.0/255.0 alpha:1.0];
			
			fname.font = font;
			
			
			
			[des addSubview:fname];
			[fname release];
			widd +=labelsize.width;
		}

你可能感兴趣的:(C++,c,Objective-C,xcode,C#)