Toast功能的实现(二)

以前,写了一篇:Toast功能的实现,这篇实现的功能类似。主要是使用了OMGToast类,可以灵活控制Toast的位置、颜色、背景、时间等。

调用也很方便:

[OMGToast showWithText:@"中间显示" duration:5];
[OMGToast showWithText:@"距离上方50像素" topOffset:50 duration:5];
[OMGToast showWithText:@"文字很多的时候,我就会自动折行,最大宽度280像素" topOffset:100 duration:5];
[OMGToast showWithText:@"加入\\n也可以\n显示\n多\n行" topOffset:300 duration:5];
[OMGToast showWithText:@"距离下方3像素" bottomOffset:3 duration:5];

具体实现请参考附件。

猜你喜欢

转载自eric-gao.iteye.com/blog/1706850