Coder Social home page Coder Social logo

lambda-alert's People

Contributors

brandondean avatar hamrickdavid avatar jcoleman avatar orip avatar zoul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lambda-alert's Issues

Presenting a long list in a CCActionSheet has issues

Causes drawing issues and does not present full list of options

la bug

Source code of test view controller:

//
//  HILIFieldMappingViewController.m
//  ListIQ
//
//  Created by Human Inference on 02/04/14.
//  Copyright (c) 2014 Human Inference. All rights reserved.
//

#import "HILIFieldMappingViewController.h"
#import "CCActionSheet.h"

@interface HILIFieldMappingViewController ()
{
    NSArray *dataArray;
    NSArray *fieldNames;
    NSArray *fieldSample;
    NSArray *fieldTypes;
//    UIPopoverController *poc;
}

@end

@implementation HILIFieldMappingViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    fieldTypes = @[@"Disregard this", @"Given name", @"Family name", @"Full name", @"Addressline",
                   @"City", @"State", @"Postal code", @"Country", @"Street", @"House number", @"Phone number", @"Fax number", @"Email", @"Website", @"Twitter ID", @"Facebook ID", @"LinkedIn ID", @"Record ID", @"Company", @"Gender", @"Age"];

    fieldNames = @[
                   @"NAME",
                   @"ADDRESS_1",
                   @"ADDRESS_2",
                   @"ADDRESS_3",
                   @"ADDRESS_4",
                   @"CITY",
                   @"STATE",
                   @"POSTCODE",
                   @"COUNTRY"
                   ];

    fieldSample = @[
                    @"MS VIJAYA MAHESH SHARMA",
                    @"Perelsplatz 14-15",
                    @"APT # 806",
                    @"20 RIVER COURT",
                    @"",
                    @"Jersey City",
                    @"NJ",
                    @"7310",
                    @"US"
                    ];
    dataArray = @[
    [[NSMutableArray alloc] initWithArray:@[
                                                        @"Full name",
                                                        @"Addressline",
                                                        @"Addressline",
                                                        @"Addressline",
                                                        @"Addressline",
                                                        @"City",
                                                        @"State",
                                                        @"Postal code",
                                                        @"Country"
                                                        ]] ];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return dataArray.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    //Number of rows it should expect should be based on the section
    /*
     NSDictionary *dictionary = [dataArray objectAtIndex:section];
     NSArray *array = [dictionary objectForKey:@"data"];
     return [array count];
     */
    NSArray *array = dataArray[section];
    return [array count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"FIELD_MAPPING";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    // Title is field name for index
    cell.textLabel.text = [NSString stringWithFormat:@"%@ (sample value '%@')", fieldNames[indexPath.row], fieldSample[indexPath.row]];

    NSArray *array = dataArray[indexPath.section];

    NSString *cellValue = [array objectAtIndex:indexPath.row];
    cell.detailTextLabel.text = cellValue;
    return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

    NSArray *sections = @[@"Field mappings"];
    if (section < sections.count) {
        return sections[section];
    }
    return [NSString stringWithFormat:@"Unnamed section %ld", (long)section];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    CCActionSheet *sheet = [[CCActionSheet alloc] initWithTitle:[NSString stringWithFormat:@"Set field type for %@", fieldNames[indexPath.row]]];
    NSMutableArray *currentFieldTypes = dataArray[0];
    for (NSString *s in fieldTypes) {
        [sheet addButtonWithTitle:s block:^{ currentFieldTypes[indexPath.row] = s; [tableView reloadData]; }];
    }

    [sheet addCancelButtonWithTitle:[NSString stringWithFormat:@"Leave '%@' as %@", fieldNames[indexPath.row], currentFieldTypes[indexPath.row]]];

    CGRect aFrame = [tableView rectForRowAtIndexPath:indexPath];
    [sheet showFromRect:aFrame inView:tableView animated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

Convert code to ARC

It’s very simple except the self-retaining trick. Maybe we can use a small retain cycle (strong-referenced id property) to accomplish the trick?

iOS 7 support

Hi there, nice work. I know that since iOS 8 UIAlertController is recommended. However in my project I would like to support iOS7 but also would like to use blocks in UIAlertView. Is iOS 7 supported within this library? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.