当前位置: 编程技术>移动开发
本页文章导读:
▪免费素材下载:Box Of Bundles Number 二 免费素材下载:Box Of Bundles Number 2
日期:2012-4-24 来源:GBin1.com
本地下载
大家还记得我们以前分享过的来自boxofbundles.com的免费设计素材,图标和模板
吧,今天我们带来了boxofbundles第二.........
▪ UIView的drawRect步骤 UIView的drawRect方法
UIView的drawRect方法
自定义一个UIView类,代码如下:
MainView.h
#import <UIKit/UIKit.h>
@interface MainView : UIView {
}
@end
MainView.m
#import "MainView.h"
@implementation M.........
▪ 判断一个时间是不是在开始时间与结束时间之间 判断一个时间是否在开始时间与结束时间之间
/** * 判断时间是否在Order_Start_Time和Order_End_Time之间 * @param date1 * @param date2 * @return */ public static boolean uploadOrderTimeRegular(String startTime, String end.........
[1]免费素材下载:Box Of Bundles Number 二
来源: 互联网 发布时间: 2014-02-18
免费素材下载:Box Of Bundles Number 2
日期:2012-4-24 来源:GBin1.com
本地下载
大家还记得我们以前分享过的来自boxofbundles.com的免费设计素材,图标和模板 吧,今天我们带来了boxofbundles第二部分 的免费素材,希望大家喜欢!
在第二部分素材下载中,我们将分享65个免费下载的设计素材,包含了各种按钮和主题皮肤设计,千万不要错过了这些超棒的素材 。
Aaron Moody’s Callendar Norm Uiparade’s CSS Ribbon Sacha Greif’s CSS Ribbon Alexandre Launched Pixel’s Kit UI Elements Dmitry Zaborskikh’s Icon Desk Ionut Zamfir’s Share Buttons Jon-Paul Lunney’s Little Glyphs Icon....
来源:免费素材下载:Box Of Bundles Number 2
[2] UIView的drawRect步骤
来源: 互联网 发布时间: 2014-02-18
UIView的drawRect方法
UIView的drawRect方法
自定义一个UIView类,代码如下:
MainView.h
#import <UIKit/UIKit.h>
@interface MainView : UIView {
}
@end
MainView.m
#import "MainView.h"
@implementation MainView
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
}
self.backgroundColor=[UIColor cyanColor];
return self;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code.
//获得处理的上下文
CGContextRef context = UIGraphicsGetCurrentContext();
//设置线条样式
CGContextSetLineCap(context, kCGLineCapSquare);
//设置线条粗细宽度
CGContextSetLineWidth(context, 1.0);
//设置颜色
CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);
//开始一个起始路径
CGContextBeginPath(context);
//起始点设置为(0,0):注意这是上下文对应区域中的相对坐标,
CGContextMoveToPoint(context, 0, 0);
//设置下一个坐标点
CGContextAddLineToPoint(context, 100, 100);
//设置下一个坐标点
CGContextAddLineToPoint(context, 0, 150);
//设置下一个坐标点
CGContextAddLineToPoint(context, 50, 180);
//连接上面定义的坐标点
CGContextStrokePath(context);
}
- (void)dealloc {
[super dealloc];
}
@end
在Xcode中创建Application-Base项目:(这里项目名假设为 Test95)
Test95AppDelegate.h代码:
#import <UIKit/UIKit.h>
#import "MainView.h"
@interface Test95AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
MainView *mainView;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
Test95AppDelegate.m中的didFinishLaunchingWithOptions方法代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
CGRect wholeWindow=CGRectMake(0, 20, 320, 320);
mainView=[[MainView alloc]initWithFrame:wholeWindow];
[self.window addSubview:mainView];
[self.window makeKeyAndVisible];
return YES;
}
结果如下图:
[3] 判断一个时间是不是在开始时间与结束时间之间
来源: 互联网 发布时间: 2014-02-18
判断一个时间是否在开始时间与结束时间之间
/**
* 判断时间是否在Order_Start_Time和Order_End_Time之间
* @param date1
* @param date2
* @return
*/
public static boolean uploadOrderTimeRegular(String startTime, String endTime) {
boolean flag = false ;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date dt1 = df.parse(startTime);
Date dt2 = df.parse(endTime);
Date d = df.parse(df.format(new Date()));//当前时间的年月日 时分
System.out.println("----d--"+df.format(new Date()) );
if(d.getTime()>dt1.getTime() && d.getTime()<dt2.getTime()){
flag = true ;
}
} catch (Exception e) {
e.printStackTrace() ;
}
return flag ;
}
/**
* 判断时间是否在Order_Start_Time和Order_End_Time之间
* @param date1
* @param date2
* @return
*/
public static boolean uploadOrderTimeRegular(String startTime, String endTime) {
boolean flag = false ;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date dt1 = df.parse(startTime);
Date dt2 = df.parse(endTime);
Date d = df.parse(df.format(new Date()));//当前时间的年月日 时分
System.out.println("----d--"+df.format(new Date()) );
if(d.getTime()>dt1.getTime() && d.getTime()<dt2.getTime()){
flag = true ;
}
} catch (Exception e) {
e.printStackTrace() ;
}
return flag ;
}
最新技术文章: