afdropdownnotification
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiYWan5iMyIzNwADO3UTN0EjM5IzLcFDM1EDMy8CXyQTN3AjNvw1ZvxmYvwVbvNmLn9GbiRXauNmLzV2Zh1Wavw1LcpDc0RHaiojIsJye.gif)
dropdown notification view for ios.
下拉通知的view,用于ios.
if you're using cocoapods, just add this line to your podfile:
如果你正在使用cocoapods,只要加这么一句话到podfile中即可:
if you're not, import these files to your project:
你可以直接将文件拖到你的项目当中:
first of all, init your afdropdownnotification class and set your main class as<code>afdropdownnotificationdelegate</code>:
首先,进入afdropdownnotification这个类,设置你的as<code>afdropdownnotificationdelegate的代理方法:</code>
you can configure the title text with the <code>titletext</code> property, the subtitle text with <code>subtitletext</code>, an optional left image defined as <code>image</code>, and two optional buttons, with <code>topbuttontext</code> and<code>bottombuttontext</code>. for example:
你可以设置titletext的属性值,也可以设置subtitletext的属性值,一个你可以控制是否显示的图片,以及两个可选的按钮,你可以分别设置这两个按钮的文本,例如:
if you want to hide the notification by tapping it, set <code>dimissontap</code> to yes:
如果你想在点击了通知后隐藏掉通知,你只需要将dimissontap设置成yes即可:
to present it, you can choose if you want to use uikit dynamics (which will include a subtle bounce) or a regular lineal uikit animation:
为了要显示出通知的view,你可以使用重力感应的属性(这个会包括一个弹跳的效果)或者是普通的uikit动画效果:
finally, to handle the buttons taps, implement the two methods defined by the delegate, <code>-dropdownnotificationtopbuttontapped</code> and <code>-dropdownnotificationbottombuttontapped</code>.
最后,为了能控制按钮事件,实现下面的两个代理方法即可.
light theme
autolayout support for rotation
afdropdownnotification is under mit license so feel free to use it!