BubbleButtonView - 将字符串分解为多个气泡然后排列到一个 view上
2013-03-11 00:49
274 查看
https://github.com/bennyguitar/iOS----BubbleButtonView
into your project. Then, include the following frameworks under Link Binary With Libraries:
QuartzCore.framework
Using
Make sure to
ViewController you want to use the BubbleButtonView in.
BBView works by taking an array of NSStrings and creating a UIButton for each one. The buttons are systematically added to the View such that they will fit on the line next to the last one, or if it won't fit, added on a new line. Because BBView's animations
work via subviews (each UIButton is a subview of BBView), you should make BBView the lowest level possible - don't add more UI elements to BBView. Keep it simple.
Begin by making a new UIView in your ViewController.xib, and changing its class to BBView (through the identity inspector in the right bar). Drag this over to your ViewController.h to connect it up. In your .h
Notice we added the BBDelegate to your ViewController, and make sure you set bubbleView's delegate to self inside ViewDidLoad or wherever you instantiate your BBView.
Now, to fill the BBView with your buttons, first create an NSArray of NSStrings. Ideally, this would tie into data you wish to manipulate - this part is entierly dependent on your project and what you wish to do. BBView also has arguments for the background
color, text color and font-size for each button. This is for UI and again, entirely up to you. This is the function you should call inside your ViewController:
Each UIButton is given a tag based on the index of the array you pass in. Use the
do so.
Reap
This project is distributed under the standard MIT License. Please use this and twist it in whatever fashion you wish - and recommend any cool changes to help the code.
BubbleButtonView
Dynamically fill a subclassed UIView with rounded-corner UIButtons based off of an array of strings. This class also sequentially animates the adding and removing of buttons for a nice UI touch.Installation
Drag the includedBBView.m, BBView.hfiles
into your project. Then, include the following frameworks under Link Binary With Libraries:
QuartzCore.framework
Using
BBView
Make sure to #import BBView.hinto whatever
ViewController you want to use the BubbleButtonView in.
BBView works by taking an array of NSStrings and creating a UIButton for each one. The buttons are systematically added to the View such that they will fit on the line next to the last one, or if it won't fit, added on a new line. Because BBView's animations
work via subviews (each UIButton is a subview of BBView), you should make BBView the lowest level possible - don't add more UI elements to BBView. Keep it simple.
Begin by making a new UIView in your ViewController.xib, and changing its class to BBView (through the identity inspector in the right bar). Drag this over to your ViewController.h to connect it up. In your .h
@interface ViewController : UIViewController <BBDelegate> { __weak IBOutlet BBView *bubbleView; }
Notice we added the BBDelegate to your ViewController, and make sure you set bubbleView's delegate to self inside ViewDidLoad or wherever you instantiate your BBView.
Now, to fill the BBView with your buttons, first create an NSArray of NSStrings. Ideally, this would tie into data you wish to manipulate - this part is entierly dependent on your project and what you wish to do. BBView also has arguments for the background
color, text color and font-size for each button. This is for UI and again, entirely up to you. This is the function you should call inside your ViewController:
[bubbleView fillBubbleViewWithButtons:NSArray bgColor:UIColor textColor:UIColor fontSize:float];
Each UIButton is given a tag based on the index of the array you pass in. Use the
-(void)didClickBubbleButton:(UIButton *)bubble;method from the BBDelegate to manipulate your data. Use
bubble.tagto
do so.
Reap
What I Sow!
This project is distributed under the standard MIT License. Please use this and twist it in whatever fashion you wish - and recommend any cool changes to help the code.
相关文章推荐
- 在控制台上输入一个字符串,将其中夹杂的字母去除,只剩数字,然后对对这些数字进行全排列,输出全排列结果
- IOS中可以一个多个xib文件对应一个类。当然也可以在一个Xib中创建多个view然后也是用一个类控制
- 在控制台上输入一个字符串,将其中夹杂的字母去除,只剩数字,然后对对这些数字进行全排列,输出全排列结果
- 题目:剔除一个字符中重复的字符,然后按ASCII码值从小到大排列。 例如,输入:abbcccddeeeffgghh 输出:abcdefgh 注意:1、剔除是整个字符串中重复的字符,而不是连续的字符 2
- USTC机试—从键盘输入 N,建立 N*N矩阵,每个元素是一个字符串,为每个元素赋值。然后求 出按字典序排列最大的元素所在的行列。
- 编写函数void change(char *a,char *b,char*c)。 函数功能是首先把b指向的字符串逆向存放,然后将a指向的字符串和b指向的字符串按排列顺序交叉合并到c指向的数组中,两个字
- C#控制台基础 path.combine合并多个字符串,返回一个路径
- 【面试)把一个字符串里除了大小写字母以外的所有东西都去掉,然后都变成小写,之后按顺序排序
- iOS 灵活,简易,扩展性强的气泡提示框LFBubbleView(含源码)
- java输入一个字符串,打印出该字符串中字符的所有排列,随机打乱排序
- C语言 编写一个函数reverse_string(char * string)(递归实现) 实现:将参数字符串中的字符反向排列
- (C++)剑指offer-27:字符串的排列(分解让复杂问题简单)(没太懂)
- 从CScrollView继承一个,然后可以往里面添加Dialog,类似于Panle
- android 同时点击多个button 避免同时响应,只响应一个点击事件 (是否允许多点触控)
- 编程序将一个字符串的前N个子字符送到一个字符型数组中去,然后再加上一个'\0'(不允许使用strcoy(str1,str2,n)函数)。
- 《将一个字符串转换成datetime时,先分析该字符串以获取日期,然后再将每个变量放置到datetime对象中》的解决办法
- 编写一个函数reverse_string(char * string) 实现:将参数字符串中的字符反向排列。
- URL 的查询字符串,比如localhost:8080?name=Alice里面的name,可以用req.query.name拿到。请修改一个路由,使之可以收到查询字符串,然后输出'Hello ' +
- 关于Fragment中定义一个ListView,然后给这个ListView添加header(ViewPager)的问题
- 一个textView显示多个字体大小