-
Notifications
You must be signed in to change notification settings - Fork 421
CAAlertView
Tooltip control, if button number is less than two in tooltip, then buttons are arranged in a horizontal array, if the number is more than two, then buttons are arranged in a vertical array.
CAView,CATableViewDataSource,CATableViewDelegate
Access modifier |
Attribute name |
Description |
public |
Title |
Tooltip’s title |
public |
alertMsg |
Tooltip’s prompt message |
public |
MsgFontName |
Prompt message’s font |
public |
Text |
Text |
public |
TitleColor |
Title color |
public |
TitleImage |
Title background |
public |
alertMsgColor |
Prompt message color |
public |
ContentBackGroundImage |
Prompt message background |
Access modifier |
Method name |
Description |
public |
create |
Build a alertView |
public |
showMessage |
Set tooltip’s title, prompt message and button |
public |
setTarget |
Set button’s callback event |
public |
setMessageFontName |
Set prompt message’s font name |
public |
setTitle |
Set title |
public |
setTitleImage |
Set title’s background |
public |
setAlertMessage |
Set prompt message |
public |
setContentBackGroundImage |
Set prompt message’s background |
public |
setAllBtnBackGroundImage |
Set background of all buttons |
public |
setAllBtnTextColor |
Set color of all button titles |
Title
Type: string
Description: title that is above tooltip
alertMsg
Type: string
Description: title that is above tooltip
MsgFontName
Type: string
Description: prompt message’s font
Text
Type: string
Description: title that is above tooltip
TitleColor
Type: string
Description: title that is above tooltip
TitleImage
Type: string
Description: title that is above tooltip
alertMsgColor
Type: string
Description: title that is above tooltip
ContentBackGroundImage
Type: string
Description: title that is above tooltip
static CAAlertView *create()
Return value: CAAlertView*
Description: build a alertView
void showMessage(std::string title, std::string alertMsg,std::vector&vBtnText)
Return value: CAAlertView*
Parameter:
Type |
Parameter name |
Description |
string |
title |
Title |
string |
alertMsg |
Prompt message |
vector |
vBtnText |
Button array |
void setTarget(CAObject target, SEL_CAlertBtnEvent selector)*
Return value: void
Description: add click event for button on alertView, callback SEL_CAlertBtnEvent will transfer a n int type index value which is auto built when adding button.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
CAAlertView* alertView = CAAlertView::create(); vector<string> btn_Text; for (int i = 0; i <5; i++) { char str[10]; sprintf(str, "btn%d", i); btn_Text.push_back(str); } alertView->showMessage("Title","Infomation",btn_Text); alertView->setTitle("Alert", CAColor_green); alertView->setAlertMessage("Message",CAColor_orange); alertView->setTarget(this,SEL_CAlertBtnEvent(&SecondViewController::clickButton)); void SecondViewController::clickButton(int index) { CCLog("You have clicked %d", index); }</string> |
void setMessageFontName(std::string var)
Return value: void
Description: set font name of prompt message.
void setTitle(std::string var, CAColor4B col = CAColor_black)
Return value: void
Description: set alertView’s title and appoint title color and optional parameters.
void setTitleImage(CAImage image)*
Return value: void
Description: set title’s background
void setAlertMessage(std::string var, CAColor4B col = CAColor_black)
Return value: void
Description: set content of prompt message, and appoint text color and optional parameters.
void setContentBackGroundImage(CAImage image)*
Return value: void
Description: set background of prompt message.
void setAllBtnBackGroundImage(CAControlState controlState, CAImage image)*
Return value: void
Type |
Parameter name |
Description |
CAControlState |
controlState |
Button status |
CAImage* |
image |
background |
void setAllBtnTextColor(CAColor4B col = CAColor_white)
Return value: void
Description: set title color of all buttons and optional parameters.