Skip to content

Commit b6ecae4

Browse files
committed
alertview ok,with no delegate yet
1 parent d00bc88 commit b6ecae4

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Classes/JSContext+JavaScriptBridge.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ -(void)addCreator
7171

7272
return anInstance;
7373
};
74+
75+
self[@"create_alert"] = ^(NSString *title,NSString* msg,NSString* cancel,NSString* ok){
76+
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title
77+
message:msg
78+
delegate:nil
79+
cancelButtonTitle:cancel otherButtonTitles:ok, nil];
80+
81+
return alert;
82+
};
83+
7484
}
7585

7686
@end

Examples/UICatalog/UICatalog/js/buttonsViewController.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ var ButtonsViewController = JSB.defineClass('ButtonsViewController : UITableView
7575
tableViewTitleForHeaderInSection: function(tableView, section) {
7676
return self.dataSourceArray[section]['sectionTitleKey'];
7777
},
78+
//@chenee:003 tmp comment!!
7879
// tableViewHeightForRowAtIndexPath: function(tableView, indexPath) {
7980
// return (indexPath.row == 0) ? 50 : 38;
8081
// },
@@ -119,7 +120,8 @@ var ButtonsViewController = JSB.defineClass('ButtonsViewController : UITableView
119120
}
120121
},
121122
action: function(sender) {
122-
var alertView = UIAlertView.alloc().initWithTitleMessageDelegateCancelButtonTitleOtherButtonTitles('Alert', 'Button pushed.', null, 'Cancel', ['OK']);
123+
// var alertView = UIAlertView.alloc().initWithTitleMessageDelegateCancelButtonTitleOtherButtonTitles('Alert', 'Button pushed.', null, 'Cancel', ['OK']);
124+
var alertView = create_alert('Alert', 'Button pushed.', 'Cancel', 'OK');
123125
alertView.show();
124126
}
125127
});

0 commit comments

Comments
 (0)