【代码笔记】iOS-点击顶点处,弹出另一个小的界面
一,效果图。


二,文件目录。

三,代码。
RootViewController.h

#import <UIKit/UIKit.h> @interface RootViewController : UIViewController
<UITableViewDataSource,UITableViewDelegate>
{
UIView * _huiView;
UITableView * _btnTableView;
UITableView * _tableView; }
@end

RootViewController.m

#import "RootViewController.h" @interface RootViewController () @end @implementation RootViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
} - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view. //初始化背景图
[self initBackGroundView];
}
#pragma -mark -functions
-(void)initBackGroundView
{
//大的tableView
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,90, 320, self.view.bounds.size.height )];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.backgroundColor=[UIColor whiteColor];
[self.view addSubview:_tableView]; //点击单元格时候的UIView
_huiView = [[UIView alloc] initWithFrame:CGRectMake(-320, 90, 320, self.view.bounds.size.height)];
_huiView.backgroundColor = [UIColor blueColor];
_huiView.alpha=0.9;
_huiView.layer.cornerRadius = 10;
[self.view addSubview:_huiView]; //三角形
NSString *path = [[NSBundle mainBundle] pathForResource:@"shangwu_shaixuan_sanjiaoxing" ofType:@"png"];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(150, 12, 20, 15);
[_huiView addSubview:imageView]; //红色的线
UIView * view = [[UIView alloc] initWithFrame:CGRectMake(10, 27, 300, 3)];
view.backgroundColor = [UIColor redColor];
[_huiView addSubview:view]; //用于选择的tableView
_btnTableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 30,300,200) style:UITableViewStylePlain];
_btnTableView.delegate = self;
_btnTableView.dataSource = self;
_btnTableView.layer.cornerRadius = 10;
[_huiView addSubview:_btnTableView]; }
#pragma -mark -UITableViewDelegate
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView == _tableView){
return 100;
}
return 50;
} -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == _tableView){
return 100;
}
return 5;
} -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView == _btnTableView){
static NSString * cellName = @"cellName";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName];
if (cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
}
if (indexPath.row == 0){
cell.textLabel.text = @"";
return cell; }
cell.textLabel.text = @"美食";
cell.textLabel.textColor = [UIColor blackColor];
return cell; }else { static NSString * cellName = @"cell";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName];
if (cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
}
if (indexPath.row == 0){
cell.textLabel.text = @"";
return cell; }
cell.textLabel.text = @"锻炼";
cell.textLabel.textColor = [UIColor blackColor];
return cell;
}
} -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"----didSelectRowAtIndexPath----");
if (tableView==_tableView) {
[UIView animateWithDuration:0.7 animations:^{
_huiView.frame = CGRectMake(0, 45+45, 320, self.view.bounds.size.height);
}]; }else{
[UIView animateWithDuration:0.7 animations:^{
_huiView.frame = CGRectMake(-320, 45+45, 320, self.view.bounds.size.height);
}];
} } - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

【代码笔记】iOS-点击顶点处,弹出另一个小的界面的更多相关文章
- iOS 点击注释图标 弹出对应解释
需求:如题目 接上一篇的开发内容 效果图: 这种情况存在tableView 的一个cell中. 要点 1, 弹出的对应解释 要在可视区域,并且小尖角 要指着 图片 2, 文本不能过高 有极大高度 ...
- ionic3 点击输入 框弹出白色遮罩 并把 界面顶到上面
这个蛋疼 问题 ,在android 上面遇到这种情况 ,键盘弹出的时候 总有一个白色的遮罩在后面出现,网上查了很久都没发现原因. 偶然发现一个方法 ,试下了下 问题解决了. 代码如下: IonicMo ...
- MFC 点击按钮,弹出另一个对话框(模态及非模态对话框)
1. 模态对话框 资源视图->Dialog->右键->添加资源->新建->对话框->右键->添加类. 例如:在A_dialog中点击按钮弹出B_dialog ...
- 【代码笔记】iOS-点击搜索跳转到另外一个页面
一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...
- iOS 点击TextField不弹出软键盘的解决方案
开发中遇到: 在模拟器里面,textfield可以通过电脑键盘输入,可是怎么也不会自动弹出模拟器软键盘 解决方案: 切换一下键盘,command+shift+k,Xcode6.3 中只能是一种输入源
- js实现点击<li>标签弹出其索引值
据说这是一道笔试题,以下是代码,没什么要文字叙述的,就是点击哪个<li>弹出哪个<li>的索引值即可: <html> <head> <style& ...
- 原生js日期时间插件鼠标点击文本框弹出日期时间表格选择日期时间
原文出处 (这是我从互联网上搜来的,感觉能满足各方面的需求.个人感觉挺不错的,所以后期修改了一下向大家推荐!) 效果图: html代码: <!DOCTYPE html PUBLIC " ...
- 解决IOS safari在input focus弹出输入法时不支持position fixed的问题
该文章为转载 我们在做移动web应用的时候,常常习惯于使用position:fixed把一个input框作为提问或者搜索框固定在页面底部.但在IOS的safari和webview中,对position ...
- 基于jQuery点击圆形边框弹出图片信息
分享一款基于jQuery点击圆形边框弹出图片信息.这是一款鼠标经过图片转换成圆形边框,点击可弹出文字信息.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div id=&q ...
随机推荐
- HTML语义化:HTML5新标签——template
一.前言 当我们使用String-base的模板引擎(如Handlebars.js等)时,要么就通过外部文件存放模板文本,需要时再通过XHR或script标签加载进来:要么通过<script t ...
- [Core] .NET Core & VS Code 之路(1) Hello World
目录 相关链接 dotnet命令 VS Code Hello World Web Hello World 总结 其实本篇上个月已经写好, 只是 但是,不忘初心方得始终 相关链接 Learn .NET ...
- Emit学习(4) - Dapper解析之数据对象映射(二)
承接着上一篇, 这一篇主要以堆栈的方式来演示一下, db数据转换到类中去的一个过程. 一.先看第一张图 程序在运行到176行(上一篇贴出的代码)的时候, 就会出现上图中的第一个栈. 那在此之前, Da ...
- T-SQL删除重复数据
数据重复分为两种情况:一种是每个字段都相同的完全重复,第二种是部分字段重复的结果集.比如Name字段重复,而其他字段不一定重复或者重复可以忽略. 第一种情况比较容易解决,使用select distin ...
- html5画布的旋转效果
keleyi.htm的代码如下: <!DOCTYPE HTML> <html> <head> <title>html旋转画布-柯乐义</title ...
- 快速学习JavaScript面向对象编程
到处都是属性.方法,代码极其难懂,天哪,我的程序员,你究竟在做什么?仔细看看这篇指南,让我们一起写出优雅的面向对象的JavaScript代码吧! 作为一个开发者,能否写出优雅的代码对于你的职业生涯至关 ...
- 深度技术32位Win7系统Ghost版2014年
深度技术32位Win7系统Ghost版,GhostWin7是指使用Ghost软件做成压缩包的Windows7,俗称克隆版Win7.用克隆版的目的是节省安装时间.本作品在采用微软封装部署技术的基础上,结 ...
- Redis配置集群二(window)
第一篇那redis的基础命令都差不多讲了一遍了,这篇就将怎么配置集群了,最后要达到的效果是一台主redis,还有几台从的redis,每次数据都是同步的,当主redis挂掉了,那么就会从几台从redis ...
- JAVA中的输入方法
输入整数(int)类型 导入包 import java.io.*; 输入语句 BufferedReader myIn=new BufferedReader(new inputStreamReader( ...
- gcd和ex_gcd
gcd就是欧几里得算法,可以快速的求出俩个数的最大公因数,进而也可以求其最大公倍数(俩数之积除以最大公因数),比较简单直接看代码就好了,一般用递归版,简短精简,敲得快,但如果数剧奇葩,怕溢出,那就用递 ...