其實不只這件,Chrome在某些HTML的呈現與layout效果,似乎也不是很正確,反而是Safari真的是比較正確一點,也比較沒有問題...要不是Safari的memory usage比較大,而且
這真的是一大諷刺啊...Google...
+ (id) sharedInstance;然後,在對應的.m檔案中,添加下列內容:
static MyManager *instance = nil;@implementation MyManager#pragma mark Singleton Methods+ (id)sharedInstance {@synchronized(self) {if(sharedMyManager == nil)sharedMyManager = [[super allocWithZone:NULL] init];}return sharedMyManager;}+ (id)allocWithZone:(NSZone *)zone {return [[self sharedManager] retain];}- (id)copyWithZone:(NSZone *)zone {return self;}- (id)retain {return self;}- (unsigned)retainCount {return UINT_MAX; //denotes an object that cannot be released}- (void)release {// never release}- (id)autorelease {return self;}- (id)init {if (self = [super init]) {// initialize your instance variables}return self;}- (void)dealloc {// Should never be called, but just here for clarity really.// release your instance variables[super dealloc];}@end
sudo apt-get install x-window-system-core gnome-core
#import "APXML.h"就可以使用到全部的相關類別,不必一一去import個別的class。
APDocument *doc = [APDocument documentWithXMLString:xmlstring];
APElement *rootElem = [doc rootElement];
NSArray *childElements = [rootElem childElements];
NSString *elementName = elem.name;
NSString *elementValue = elem.value;
NSString *attrValue = [elem valueForAttributeNamed:attributeName];
APElement *elem = [APElement elementWithName:elementName];
[elem addAttributeNamed:attrName withValue:attiValue];[elem appendValue:elementValue];
[elem addChild: childElem];
APDocument *doc = [[APDocument alloc] initWithRootElement: elem];
NSString *xmlString = [doc xml];
@implementation NSString (TextHeight)-(CGFloat) textHeightForSystemFontOfSize:(CGFloat)size {//Calculate the expected size based on the font and linebreak mode of the labelCGFloat maxWidth = [UIScreen mainScreen].bounds.size.width - 50;CGFloat maxHeight = 9999;CGSize maximumLabelSize = CGSizeMake(maxWidth,maxHeight);CGSize expectedLabelSize = [self sizeWithFont:[UIFont systemFontOfSize:size] constrainedToSize:maximumLabelSize lineBreakMode:UILineBreakModeWordWrap];return expectedLabelSize.height;}@end