UIView 和Label

//

//  AppDelegate.m

//  UI_Lesson1

//

//  Created by 李洪鹏 on 15/6/29.

//  Copyright (c) 2015年 李洪鹏. All rights reserved.

//

#import "AppDelegate.h"

#define kwindth 150

#define kheight 45

#define kmargin 20

@interface AppDelegate ()

@end

@implementation AppDelegate

-(void)dealloc

{

[_window release];

[super dealloc];

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Override point for customization after application launch.

self.window = [[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds] autorelease];

self.window.backgroundColor = [UIColor greenColor];

[self.window makeKeyAndVisible];

UIView *UseName2 = [[UIView alloc] initWithFrame:CGRectMake(50, 100, kwindth, kheight)];

UseName2.backgroundColor = [UIColor redColor];

[self.window addSubview:UseName2];

UIView *aview = [[[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(UseName2.frame), CGRectGetMaxY(UseName2.frame) + kmargin, kwindth, kheight)] autorelease];

aview.backgroundColor = [UIColor redColor];

[self.window addSubview:aview];

//    UIView *bView = [[[UIView alloc] initWithFrame:CGRectMake(50, 100, 50, 50)] autorelease];

//    bView.backgroundColor = [UIColor orangeColor];

//    [self.window addSubview:bView];

//

//    UIView *cView = [[[UIView alloc] initWithFrame:CGRectMake(50, 200, 50, 50)] autorelease];

//    cView.backgroundColor = [UIColor orangeColor];

//    [self.window addSubview:cView];

//    UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)] autorelease];

//    view.backgroundColor = [UIColor redColor];

//

//    //设置圆角度

//    view.layer.cornerRadius = 50;

//

//    [self.window addSubview:view];

//    Label

//    UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 100)] autorelease];

//    label.text = @"我是一个label。我是一个label。我是一个label。我是一个label。我是一个label。我是一个label。";

//    label.backgroundColor = [UIColor grayColor];

//

//    //设置字体的颜色

//    label.textColor = [UIColor colorWithRed:0.1 green:0.2 blue:0.5 alpha:1.0f];

//

//

//    //设置字体的大小,默认是17号字体

//    label.font = [UIFont systemFontOfSize:10.0f];

//

//    //设置对齐的方式

//    label.textAlignment = NSTextAlignmentCenter;

//

//    //设置阴影颜色

//    label.shadowColor = [UIColor yellowColor];

//

//    //改变阴影的偏移量

//    label.shadowOffset = CGSizeMake(10, 10);

//

//    //设置透明度

//    label.alpha = 0.8;

//

//    //让Label换行, 如果不知道label到底是几行,设置为0

//    label.numberOfLines = 0;

//

//

//    //设置label得断行

//    label.lineBreakMode = NSLineBreakByTruncatingHead;

//    [self.window addSubview: label];

//修改的是bounds

//    self.window.bounds = CGRectMake(50, 50, 320, 480);

//

//    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

//    view.backgroundColor = [UIColor blueColor];

//

//    [self.window addSubview:view];

return YES;

}

- (void)applicationWillResignActive:(UIApplication *)application {

// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}

- (void)applicationDidEnterBackground:(UIApplication *)application {

// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}

- (void)applicationWillEnterForeground:(UIApplication *)application {

// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}

- (void)applicationDidBecomeActive:(UIApplication *)application {

// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}

- (void)applicationWillTerminate:(UIApplication *)application {

// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}

@end

时间: 2024-10-29 19:10:23

UIView 和Label的相关文章

实现UILabel渐变色效果

效果如下图: 源码: // // CombinationView.h // ChangeColorLabel // // Created by YouXianMing on 14/11/15. // Copyright (c) 2014年 YouXianMing. All rights reserved. // #import <UIKit/UIKit.h> @interface CombinationView : UIView /** * 上面的view与下面的view */ @proper

iOS基础笔记

/**************UIView***************/ //实例化一个UIView //frame:设置view的位置和大小  (0,0)屏幕的最左上角的点   X:正轴方向->向右 Y:正轴方向->向下 UIView *view = [[UIView alloc] init]; //设置位置和大小 //1.frame方式 view.frame = CGRectMake(50, 100, 220, 220); //    view.frame = CGRectMake(CG

iOS——MBProgressHUD详解

原链接:http://www.jianshu.com/p/59121cac78bd 另外两个大神的库:( JGProgressHUD.SVProgressHUD ) MBProgressHUD 是一个为 APP 添加 HUD 窗口的第三方框架,使用起来极其简单方便,关于 MBProgressHUD 的使用方法,GitHub 上有详细的说明,这里就不多加介绍了,本文主要是从源码的角度分析 MBProgressHUD的具体实现. 先来对 MBProgressHUD 有个大体的认识,这是刚从 GitH

iOS开发-UI (一)补充 UIWindow UIView UIlabel

之前忘了把这些整理出来,现在补充一下,应该放在前面学习的 知识点: 1.UI的初步认识 2.UIWindow 3.UIView 4.UIlabel ======================== UI的初步认识 1.什么是UI(*) UI即User Interface(用户界面)的简称.UI设计则是指对软 件的人机交互.操作逻辑.界面美观的整体设计.好的UI设 计不仅是让软件变得有个性有品味,还要让软件的操作变得 舒适.简单.自由.充分体现软件的定位和特点. 2.第一个UI工程 1)UI工程的

UI 初识UIView

1.UIWindow App靠window来呈现内容,?个程序?般只创建?个window. 通常window的??(frame)与屏幕(UIScreen)???致. ?例代码如下: self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; _window.backgroundColor = [UIColor whiteColor];    // 视图的添加写在这里    [_window makeKe

自定义uiview 当没有数据的时候 显示自定义的uiview界面

// // ZSDTJNoDataView.h // ZSDTJNoDataView // // Created by Mac on 14-12-28. // Copyright (c) 2014年 ZSD. All rights reserved. // //当发起网络请求的时候没有数据的时候界面显示指定的背景图 #import <UIKit/UIKit.h> typedef void(^ZSDNoDataViewCompleteHandler) (NSInteger buttonIndex

UIView属性的讲解

1.父控件和子控件的理解在storyboard中只有UIView是可以在里面拖入子控件的,其他控件不可以(必须通过代码添加)拖入一个UIView控件,在里面添加一些子控件(UIView控件是控制器的VIew的子控件,UIView控件是内部子控件的父控件) 2.UIView的常见属性superView : 可以通过superView的get方法拿到对应的父控件subViews : 当将一个控件添加到另外一个控件中时,该控件就会成为另一个控件的子控件. 3.UIView常见的方法addSubView

UIScreen,UIFont,UIColor,UIView,UIButton等总结

6.1 UIScreen // 屏幕的宽度 CGFloat screenW = [UIScreen mainScreen].bounds.size.width; 6.2 UIFont + (UIFont *)systemFontOfSize:(CGFloat)fontSize;   系统默认字体 + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;  粗体 + (UIFont *)italicSystemFontOfSize:(CGFloat)f

以动画的形式让label等出现消失等

[UIView animateWithDuration:1.0 animations:^{            label.alpha=1.0;        } completion:^(BOOL finished) {                        [UIView animateWithDuration:1.0 animations:^{                label.alpha=0.0;            } completion:^(BOOL finis