iOS開發(fā)中自定義彈出框

很多時(shí)候,iOS開發(fā)中需要彈出提示框來提示用戶一些信息,但是MBProgressHud的顯示可能會(huì)導(dǎo)致文字顯示不全,這個(gè)時(shí)候就需要自定義一個(gè)彈出框來顯示自己需要的文字.

-(void)updataWindows {

windows = [UIApplication sharedApplication].keyWindow;

view = [[UIView alloc]initWithFrame:CGRectMake(40, SCREEN_HEIGHT/2 - 40, SCREEN_WIDTH - 80, 80)];

view.backgroundColor = [UIColor blackColor];

view.layer.masksToBounds = YES;

view.layer.cornerRadius = 8.0f;

label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, view.bounds.size.width, 80)];

label.numberOfLines = 3;

label.text = @" 您的信息已經(jīng)重新提交,我們正在在加緊審核,請(qǐng)稍侯 ";

label.textColor = [UIColor whiteColor];

label.textAlignment = NSTextAlignmentCenter;

[windows addSubview:view];

[view addSubview:label];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)),dispatch_get_main_queue(), ^{

//2秒以后移除view

[view removeFromSuperview];

});

}

這樣就可以做出和MBProgressHud相似的效果了.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容