UI2_UISwitch与UIActivity
//
// ViewController.m
// UI2_UISwitch与UIActivity
//
// Created by zhangxueming on 15/7/7.
// Copyright (c) 2015年 zhangxueming. All rights reserved.
// #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//开关的尺寸固定大小(51*31)
UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectMake(100, 200, 0, 0)];
NSLog(@"sw = %@", sw);
sw.thumbTintColor = [UIColor redColor];
sw.tintColor = [UIColor blueColor];
sw.onTintColor = [UIColor yellowColor];
[sw addTarget:self action:@selector(swichValueChanged:) forControlEvents:UIControlEventValueChanged];
//动画打开开关
[sw setOn:YES animated:YES];
[self.view addSubview:sw]; //活动指示器
UIActivityIndicatorView * indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[self.view addSubview:indicatorView];
indicatorView.center = self.view.center;
[indicatorView startAnimating];
indicatorView.tag =100;
self.view.backgroundColor = [UIColor blackColor];
} - (void)swichValueChanged:(UISwitch *)sw
{
NSLog(@"sw value = %i", sw.on);
UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self.view viewWithTag:100];
if (sw.isOn) {
[indicator startAnimating];
}
else{
[indicator stopAnimating];
}
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
UI2_UISwitch与UIActivity的更多相关文章
- 使用subclass UIActivity的方案来分享图片
IOS6开始, 系统提供了UIActivityViewController, 对图片,文字,url进行相关的操作. 对于缺乏UI设计师的开发来说, 使用它进行轻量级的分享是很好的选择. 最大的缺点是自 ...
- ios7 上 UIActivity 用的image
在ios8 上UIActivityCategoryShare类型的UIActivity的图标支持彩色图片了,但是在ios7上不行,ios8上的 UIActivityCategoryAction类型也不 ...
- 使用自定义《UIActivity》进行内容分享-b
简介 这段时间有很多朋友都问我关于怎么去集成ShareSDK或者友盟社会化分享SDK的问题, 其实我想说, Apple一开始就提供了一个类, 供我们去使用分享了, 在iOS 6之后更加增强了这个类, ...
- Swift - 自定义UIActivity分享
UIActivity可以十分方便地将文字.图片等内容进行分享,比如分享到微信.微博.发送邮件.短信等等.我们不仅可以分享内容出来,也可以在自己的App里添加自己的分享按钮或隐藏已有的分享按钮来实现定制 ...
- UISwitch和UIActivity的使用
- (void)viewDidLoad{ [super viewDidLoad]; //创建一个开关控件,苹果给它固定的size(79*27),frame更改size无效 //继承于 ...
- UIActivityViewController 系统社交化 共享
1.UIActivityViewController是继承自UIViewController,是拥有VC的特性 a.初始化 init , initWithActivityItems:applicat ...
- iOS - Share 分享/第三方登录
1.系统方式创建分享 按照下图在 Info.plist 文件中将 Localization native development region 的值改为 China.如果不设置此项弹出的分享页面中显示 ...
- UIView---汇总
视图.绘图.贴图.手势.变形.布局.动画.动力.特效 UIBezierPath.UIGestureRecognizer.CGAffineTransform.frame.bounds.center.tr ...
- 微信在IOS7下无法分享图片
家里老大的iphone5在WWDC后第一时间升级了IOS7. 整体的UI风格和功能都很喜欢, 偶尔的crash还能接受. 但是最常用的软件之一微信,在IOS7下无法分享图片这点一直让她耿耿于怀. 从用 ...
随机推荐
- Android蓝牙传感应用
Android手机一般以客户端的角色主动连接SPP协议设备(接上蓝牙模块的数字传感器),连接流程是: 1.使用registerReceiver注册BroadcastReceiver来获取蓝牙状态.搜索 ...
- UIButton设置了UIControlStateSelected和UIControlStateHighlighted状态的图片点击会闪烁的解决方案
[btn setBackgroundImage:img1 forState:UIControlStateSelected|UIControlStateHighlighted]; [btn setIma ...
- 排序命令sort
Unix和Linux自带的sort命令功能非常强大,其主要功能是对文本内容按不同的方法排序.它不仅可以按一个或多个字段排序,还可以合并文件.使用sort处理一些较大的文件时,可能处理速度会比较慢,但却 ...
- 30款css3实现的鼠标经过图片显示描述特效
今天给大家分享30款css3实现的鼠标经过图片显示描述特效,鼠标经过这些图片的时候以非常炫的方式显示图片的描述.为保证最佳的效果,请在 IE10+.Chrome.Firefox 和 Safari 等现 ...
- 实例源码--IOS高仿微信打飞机游戏(完整功能)
下载源码 技术要点: 1. IOS游戏开发基础框架 2. 高仿打飞机游戏 3. 游戏背景音频技术 4.源码详细的中文注释 ……. 详细介绍: 1. IOS游戏开发基础框架 此套源码为涉及IOS游戏开发 ...
- 548 - Tree (UVa OJ)
Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...
- Spring JdbcTemplate的queryForList(String sql , Class<T> elementType)易错使用--转载
原文地址: http://blog.csdn.net/will_awoke/article/details/12617383 一直用ORM,今天用JdbcTemplate再次抑郁了一次. 首先看下这个 ...
- C++对象内存模型2 (虚函数,虚指针,虚函数表)
从例子入手,考察如下带有虚函数的类的对象内存模型: class A { public: virtual void vfunc1(); virtual void vfunc2(); void func1 ...
- web前端知识体系大全
1. 前言 大约在几个月之前,让我看完了<webkit技术内幕>这本书的时候,突然有了一个想法.想把整个web前端开发所需要的知识都之中在一个视图中,形成一个完整的web前端知识体系,目的 ...
- Mybank
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...