作者 陈小翰 关注

2017.03.24 18:01 字数 138 阅读 62评论 0喜欢 1

SCPromptView

SCPromptView : 显示在顶部的提示控件
你的star是我最大的动力

effect.gif

安装

手动安装

下载源码,将SCPromptView文件夹拖进项目

CocoaPod

pod 'SCPromptView'

使用

SCPromptView 的用法,与tableView相似

创建view

#import "SCPromptView.h"@interface TestPromptView : SCPromptView@end
#import "TestPromptView.h"@interface TestPromptView()
/***   label*/
@property (nonatomic,strong)UILabel *textLabel;
@end@implementation TestPromptView
//初始化子控件
-(void)sc_setUpCustomSubViews{self.backgroundColor=  [UIColor colorWithRed:(arc4random()%255)/255.f green:(arc4random()%255)/255.f blue:(arc4random()%255)/255.f alpha:1];UILabel *textLabel = [[UILabel alloc]initWithFrame:self.contentView.bounds];textLabel.textColor = [UIColor whiteColor];textLabel.textAlignment = NSTextAlignmentCenter;[self.contentView addSubview:textLabel];self.textLabel = textLabel;
}
//读取参数
-(void)sc_loadParam:(id)param{NSString *text = param;self.textLabel.text = text;
}
@end

重写两个基础方法

注册

SCPROMPT_REGISTER([TestPromptView class],@"test")
SCPROMPT_REGISTER([ResultPromptView class], @"result")

发送显示命令

///随机颜色显示
-(void)clickBtn:(id)sender{NSString * text =[NSString stringWithFormat:@"%d",_num];SCPROMPT_SHOW(@"test",text)_num++;
}

其他Api

@protocol SCPromptViewDelegate <NSObject>
@required
/***  @brief 添加自定义的子控件*/
-(void)sc_setUpCustomSubViews;
/***  @brief 子控件读取数据*/
-(void)sc_loadParam:(id)param;@optional
/***  @brief 显示时间*/
-(NSTimeInterval)sc_showTime;
/***  @brief 滑动距离*/
-(CGFloat)sc_slideDistance;
/***  @brief 震动距离*/
-(CGFloat)sc_shakeDistance;
/***  @brief 出现动画时间*/
-(NSTimeInterval)sc_showAnimationDuration;
/***  @brief 隐藏动画时间*/
-(NSTimeInterval)sc_hideAnimationDuration;
/***  @brief 即将执行由手势触发的隐藏*  @return yes 隐藏 / no 不隐藏*/
-(BOOL)sc_willHideByTap;@end

SCPromptView

SCPromptView : A prompt view which show in the top of the screen .

your star is my biggest motivation

effect.gif

Install

Manually

Download the source code , copy folder SCPromptView into your project.

CocoaPod

pod 'SCPromptView'

Usage

The usage of SCPromptView is similar to the usage of UITableView.

Create Custom View

#import "SCPromptView.h"@interface TestPromptView : SCPromptView@end
#import "TestPromptView.h"@interface TestPromptView()
/***   label*/
@property (nonatomic,strong)UILabel *textLabel;
@end@implementation TestPromptView
//setUp subviews
-(void)sc_setUpCustomSubViews{self.backgroundColor=  [UIColor colorWithRed:(arc4random()%255)/255.f green:(arc4random()%255)/255.f blue:(arc4random()%255)/255.f alpha:1];UILabel *textLabel = [[UILabel alloc]initWithFrame:self.contentView.bounds];textLabel.textColor = [UIColor whiteColor];textLabel.textAlignment = NSTextAlignmentCenter;[self.contentView addSubview:textLabel];self.textLabel = textLabel;
}
//loadParam which you deliver via command
-(void)sc_loadParam:(id)param{NSString *text = param;self.textLabel.text = text;
}
@end

Override two basic function.

Register

SCPROMPT_REGISTER([TestPromptView class],@"test")
SCPROMPT_REGISTER([ResultPromptView class], @"result")

发送显示命令

///show random color
-(void)clickBtn:(id)sender{NSString * text =[NSString stringWithFormat:@"%d",_num];SCPROMPT_SHOW(@"test",text)_num++;
}

Other Api

@protocol SCPromptViewDelegate <NSObject>
@required
/***  @brief 添加自定义的子控件*/
-(void)sc_setUpCustomSubViews;
/***  @brief 子控件读取数据*/
-(void)sc_loadParam:(id)param;@optional
/***  @brief 显示时间*/
-(NSTimeInterval)sc_showTime;
/***  @brief 滑动距离*/
-(CGFloat)sc_slideDistance;
/***  @brief 震动距离*/
-(CGFloat)sc_shakeDistance;
/***  @brief 出现动画时间*/
-(NSTimeInterval)sc_showAnimationDuration;
/***  @brief 隐藏动画时间*/
-(NSTimeInterval)sc_hideAnimationDuration;
/***  @brief 即将执行由手势触发的隐藏*  @return yes 隐藏 / no 不隐藏*/
-(BOOL)sc_willHideByTap;@end

 My Github

© 著作权归作者所有
举报文章

关注

通知提示SCPromptView相关推荐

  1. php通知前端,HTML5桌面通知提示功能的实现

    HTML5赋予网页更好的意义和结构.更加丰富的标签将随着对RDFa的,微数据与微格式等方面的支持,构建对程序.对用户都更有价值的数据驱动的Web.本文我们就和大家分享HTML5实现桌面通知提示功能. ...

  2. 安卓html5桌面提醒,HTML5桌面通知提示功能的实现

    HTML5赋予网页更好的意义和结构.更加丰富的标签将随着对RDFa的,微数据与微格式等方面的支持,构建对程序.对用户都更有价值的数据驱动的Web.本文我们就和大家分享HTML5实现桌面通知提示功能. ...

  3. Android Service下载文件并自定义通知提示下载

    最近要做一个更新sdk,里面用到了service后台下载,自定义通知提示下载进度,下面直接贴上代码. 下面是UpdateUtils.java ,告诉你如何使用 package com.cnziz.up ...

  4. iPhone 13锁屏无法收到微信通知提示怎么解决?

    相信有很多小伙伴已经入手了iPhone 13,但是出现了很多问题.今天小编就来介绍一下怎么解决微信锁屏后收不到消息. 近日,一些iPhone 13和iPhone 13 Pro系列机型的用户反馈手机在锁 ...

  5. android8.1 屏蔽通知提示

    注意区分通知和广播 在通知服务中 frameworks/base/services/core/java/com/android/server/notification/NotificationMana ...

  6. 怎么去除小米手机通知提示音

    1,打开手机,进入设置页面 2,选择声音和振动 3,选择默认通知提示音->选择铃声->选无 说明:在小米手机上测试的,其他版本手机应该是类似的.

  7. 通知提示音修改默认铃声

    近日有个需求:用户要求把手机通知的提示音改为默认的手机铃声,改了好久终于做出了,做个记录. 代码如下: /*** 启动通知*/public void showNotification(CharSequ ...

  8. 雷鸟客户端关闭后有新邮件通知提示插件——雷鸟最小化插件

    插件效果: 如上图. 插件作用:最小化或关闭后,保留在右下角工具栏中,新邮件仍有提示. 插件名称:MinimizeToTray Reanimated ps:这个插件不适用于 ver 68.6.0以上版 ...

  9. vue 使用vuex实现消息通知提示

    需求如图:因为这两个不存在组件关系,所以我们使用Vuex来解决这个实时刷新 1.首先在vuex的state定义数据如下 state: {noticeCount: 0}, 2.更改 Vuex 的 sto ...

最新文章

  1. ROS创建工作空间与节点
  2. Concurrent包下的常用并发类和普通类之间的区别
  3. nmf算法 python_NMF算法简介及python实现
  4. DynamoRIO工作原理
  5. P3399 丝绸之路(线性二维dp)
  6. [导入]Asp.Net 学习资源列表
  7. c#教程与视频教程类专题资料免费下载整理合集
  8. 卸载干净ARCGIS不用手动删注册表,一键用GEEK
  9. Ubuntu 10.04 使用libfetion
  10. 用scrapy-splash爬取淘宝
  11. 为什么微博超话显示服务器有点累,微博超话帖子被吞是什么原因?使用时,注意这些事项...
  12. PyTorch-LSTM时间序列预测中如何预测真正的未来值
  13. bbr29_TCP BBR导致性能下降
  14. java项目设计与思路
  15. 基本面分析中必须了解的88条避雷常识
  16. 后端框架之Flask--初识
  17. 使用docker安装ubuntu镜像
  18. 单词接龙acwing
  19. ADO数据库连接中的Integrated Security和Persist Security Info参数的作用
  20. 从技术趋势看质量赋能

热门文章

  1. SQL Server孤立账户解决办法
  2. Web开发的那点事--数据持久层常用功能
  3. (转)Linux进程调度时机
  4. Oracle Connect to an idle instance
  5. oracle exec 和 call 区别
  6. [C#1] 9-委托
  7. 关闭Windows 2000/XP/2003默认共享
  8. win10安装emacs+spacemacs,建议用官方安装方式
  9. Java开发环境的搭建以及使用eclipse创建项目
  10. 吴恩达老师深度学习视频课笔记:逻辑回归公式推导及C++实现