CBAlertTableView is a thing to be able to use a UITableView based on the UIAlertView.
By providing an array of strings, you can create a UIAlertView including UITabaleView that displays the string.
Generated by the class method
+ (id)alertTabaleViewWithStringArray:(NSArray *)stringArray
titile:(NSString *)title
cancelButtonTitle:(NSString *)buttonTitle
delegate:(id<CBAlertTableViewDelegate>)delegate;
When you use, you must implement the CBAlertTableViewDelegate.
@protocol CBAlertTableViewDelegate
- (void)selectedIndex:(int)index;
- (void)canceled;
@end
selectedIndex
: Called when a cell is selected. The index origin is 0.
canceled
: Called when it is canceled.
NSArray *stringArray = [NSArray arrayWithObjects:@"first",
@"seccond",
@"third",
@"fourth",
@"fifth",
nil];
CBAlertTableView *alertTabView = [CBAlertTableView alertTabaleViewWithStringArray:stringArray
titile:@"Select"
buttonTitle:@"Cancel"
delegate:self];
[alertTabView show];
You should copy below files to your projects.
CBAlertTableView.m CBAlertTableView.h
Copyright (c) 2012 CrossBridge. All rights reserved.
Licensed under the Apache License, Version 2.0;
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.