在公司里参与了一个iPhone开发项目,有关海关的,其主要实现思想是:在UIView中添加各种合适的控件,其中包含WebView,以用其来显示数据源,包括本地所设计的界面样式和服务器上的网页内容。
在此,由于种种原因,我们只讲解里边的一小部分代码,其功能是获取网页数据源的工具类 :
DM类:其基于的思想是,将url,导航条目名称,图标等信息放入到.plist文件中;然后读取.plist中的信息,并且分类放入到不同的变量中。 后续修改数据源信息时,在.plist文件中操作。
事实上,也可以不将数据源放在配置文件.plist中,而直接写入程序中,只是这样子灵活性不强而已。
DM.h:
#import <Foundation/Foundation.h>
@interface DM : NSObject {
NSString *csurl;
NSArray *tbc;
NSInteger netref;
}
@property (nonatomic, retain) NSString *csurl;
@property (nonatomic, retain) NSArray *tbc;
+ (DM *)getInstance;
- (NSString *)getTabBarTitle:(NSInteger)index;
- (NSString *)getTabBarIconPath:(NSInteger)index;
- (NSString *)getTabBarViewURL:(NSInteger)index;
- (NSInteger)getTabBarItemNumber;
- (void)netRefInc;
- (void)netRefDec;
@end