WEB开发网
开发学院手机开发iPhone 开发 自己动手写iPhone wap浏览器之界面架构篇 阅读

自己动手写iPhone wap浏览器之界面架构篇

 2010-10-19 20:45:36 来源:WEB开发网   
核心提示:@class CXmlControlImpl;@interface CXmlControl : UIView {@publicCXmlControlImpl* iImpl;}-(void) addElements:(CXmlElementImpl*)iElemntAdded;-(CXmlElement*) Insert

@class CXmlControlImpl;

@interface CXmlControl : UIView {

@public

CXmlControlImpl* iImpl;

}

-(void) addElements:(CXmlElementImpl*)iElemntAdded;

-(CXmlElement*) InsertContent:(CXmlElement*)aTarget aPosition:(NSInteger)aPosition aSource:(const NSString*)aSource aFlags:(NSInteger)aFlags;

-(CXmlElement*) AppendContent:(const NSString*)aSource aFlags:(NSInteger)aFlags;

-(void) Refresh;

-(void) RefreshAndDraw;

-(void) ClearContent;

-(void) RemoveElement:(CXmlElement*)aElement;

-(CXmlElement*) Element:(const NSString*)aId aIndex:(NSInteger)aIndex;

-(CXmlElement*) ElementByTag:(const NSString*)aTagName aIndex:(NSInteger)aIndex;

-(CXmlElement*) FocusedElement;

-(void) SetFocusTo:(CXmlElement*)aElement;

-(void) ScrollToView:(CXmlElement*)aElement;

-(CXmlElement*) Body;

-(void) SetEventObserver:(id)aObserver;

-(CXmlElementImpl*) Impl;

-(CGContextRef) SystemGc;

-(void) Draw:(const CGRect)aRect;

-(CWritableBitmap*) OffScreenBitmap;

-(void) SetOffScreenBitmap:(CWritableBitmap*)aBitmap;

-(void) DrawOffscreen;

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

@end

Tag(标签)类的基类为CXmlElement,它抽象了标签的基本属性和操作,在每一个派生自此基类的tag(标签)类如CXmlTextElement、CXmlImgElement中都维护一个全局的布局类CHcMeasureStatus,每一个tag(标签)类都负责自己的布局和自己的绘制操作,完成布局操作和绘制操作后为改变CHcMearuseStatus的状态和属性并传递给CXmlControl类。

在下一篇中笔者会尝试解析并渲染常见的Text标签,争取在元旦之前完成吧:)

本教程的系列文章和代码会被收录在笔者的新书《手把手教你iPhone开发》中,所以任何形式的商业抄袭行为会被追究相应的责任。

上一页  1 2 

Tags:自己 动手 iPhone

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接