All Projects → richzertuche → Zseatselector

richzertuche / Zseatselector

Create a Seat Map Layout

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Zseatselector

Pulltomakesoup
Custom animated pull-to-refresh that can be easily added to UIScrollView
Stars: ✭ 1,928 (+257.7%)
Mutual labels:  uiscrollview
XLRefresh
iOS 下拉刷新工具
Stars: ✭ 25 (-95.36%)
Mutual labels:  uiscrollview
Persei
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift
Stars: ✭ 3,395 (+529.87%)
Mutual labels:  uiscrollview
2DUICollectionViewSwift
A simple and elegant 2Dimensional UICollectionView which is most commonly used in ecommerce apps, music streaming apps etc. Easily customisable as per your requirements as it is designed keeping the superset requirement in mind. Developed in latest Swift syntax.
Stars: ✭ 28 (-94.81%)
Mutual labels:  uiscrollview
ZVRefreshing
A pure-swift and wieldy refresh component.
Stars: ✭ 29 (-94.62%)
Mutual labels:  uiscrollview
JQScrollNumberLabel
JQScrollNumberLabel:仿tumblr热度滚动数字条数, 一个显示数字的控件,当你改变其数字时,能够有滚动的动画,同时动画和位数可以限制,动态创建和实例化可选,字体样式自定义等。
Stars: ✭ 29 (-94.62%)
Mutual labels:  uiscrollview
Zoomy
Adds seamless scrollView and instagram like zooming to UIImageViews in any view hierarchy.
Stars: ✭ 130 (-75.88%)
Mutual labels:  uiscrollview
Jt3dscrollview
ScrollView with custom effects during the scroll for iOS
Stars: ✭ 494 (-8.35%)
Mutual labels:  uiscrollview
EmbeddedScrollView
Embedded UIScrollView for iOS.
Stars: ✭ 55 (-89.8%)
Mutual labels:  uiscrollview
Webbrowser
iOS浏览器 Web Browser for iOS
Stars: ✭ 332 (-38.4%)
Mutual labels:  uiscrollview
ISVImageScrollView
Image preview component with zoom, scroll and rotation support
Stars: ✭ 28 (-94.81%)
Mutual labels:  uiscrollview
Hola
Light-weight Onboard/Walkthrough UIView/UIImage representer ⏪ & ⏩ ⏫ & ⏬
Stars: ✭ 40 (-92.58%)
Mutual labels:  uiscrollview
Baraba
Make your UIScrollView scroll automatically when user is looking 👀 by tracking face using ARKit and AVFoundation
Stars: ✭ 268 (-50.28%)
Mutual labels:  uiscrollview
scrollRulerView
请使用 CYRuler (Please use CYRuler)
Stars: ✭ 31 (-94.25%)
Mutual labels:  uiscrollview
Mbtwitterscroll
Recreate Twitter's profile page scrolling animation for UITableView and UIScrollViews.
Stars: ✭ 421 (-21.89%)
Mutual labels:  uiscrollview
Closures
Swifty closures for UIKit and Foundation
Stars: ✭ 1,720 (+219.11%)
Mutual labels:  uiscrollview
ScrollAnimationShowcase
[ING] - UIScrollViewやUICollectionViewの特性を活用した表現サンプル
Stars: ✭ 15 (-97.22%)
Mutual labels:  uiscrollview
Pulltomakeflight
Custom animated pull-to-refresh that can be easily added to UIScrollView
Stars: ✭ 497 (-7.79%)
Mutual labels:  uiscrollview
Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+670.32%)
Mutual labels:  uiscrollview
Slidecontroller
Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.
Stars: ✭ 279 (-48.24%)
Mutual labels:  uiscrollview

ZSeatSelector

Objective-C & Swift / Create a Seat Map Layout

alt tag

You need to import ZSeatSelector and ZSeat. Also add the ZSeatSelector Delegate to your Controller:

Obj-C
#import "ZSeatSelector.h"
#import "ZSeat.h"

@interface ViewController : UIViewController <ZSeatSelectorDelegate>{
}

Swift
class ViewController: UIViewController, ZSeatSelectorDelegate {
}


**Create your map using a NSString.**

Note:
A = Available
U = Unavailable
D = Disabled
_ = Space
/ = Line Break (row)

Obj-C
NSString *map =     @"AAAAA_DAAAA/"
                    @"UAAAA_DAAAA/"
                    @"UUUUU_DAAAA/"
                    @"UAAAA_AAAAA/"
                    @"AAAAA_AAAAA/";
Swift

let map2:String =   "_DDDDDD_DDDDDD_DDDDDDDD_/" +
                    "_AAAAAA_AAAAAA_DUUUAAAA_/" +
                    "________________________/" +
                    "_AAAAAUUAAAUAAAAUAAAAAAA/" +
                    "_UAAUUUUUUUUUUUUUUUAAAAA/" +
                    "_AAAAAAAAAAAUUUUUUUAAAAA/" +
                    "_AAAAAAAAUAAAAUUUUAAAAAA/" +
                    "_AAAAAUUUAUAUAUAUUUAAAAA/"

**Create a ZSeatSelector Object as a UIScrollView**
Set Seat Size
Set Images
Set Seat Price
Finally Set Map
Obj-C
ZSeatSelector *seat = [[ZSeatSelector alloc]initWithFrame:CGRectMake(0, 30, self.view.frame.size.width, 160)];
    
    [seat setSeatSize:CGSizeMake(32, 32)];
    [seat setAvailableImage:[UIImage imageNamed:@"A"]
        andUnavailableImage:[UIImage imageNamed:@"U"]
           andDisabledImage:[UIImage imageNamed:@"D"]
           andSelectedImage:[UIImage imageNamed:@"S"]];
    [seat setSeat_price:30];
    [seat setMap:map];
    [seat setDelegate:self];
Swift
let seats2 = ZSeatSelector()
        seats2.frame = CGRectMake(0, 250, self.view.frame.size.width, 200)
        seats2.setSeatSize(CGSize(width: 30, height: 30))
        seats2.setAvailableImage(   UIImage(named: "A")!,
            andUnavailableImage:    UIImage(named: "U")!,
            andDisabledImage:       UIImage(named: "D")!,
            andSelectedImage:       UIImage(named: "S")!)
        seats2.setMap(map2)
        seats2.seat_price = 5.0
        seats2.selected_seat_limit = 5
        seats2.seatSelectorDelegate = self
        self.view.addSubview(seats2)

**Seat Limit**
You can now add Seat Limit so that if you only allow to select 3 seats, the last 3 seats the user select are the ones that will be shown, deselecting the previous ones
Obj-C
    [seat setSelected_seat_limit:3];
    
Swift
    seats2.selected_seat_limit = 5
    

Add the delegate functions

Obj-C
- (void)seatSelected:(ZSeat *)seat{
    NSLog(@"Seat at Row:%ld and Column:%ld", (long)seat.row,(long)seat.column);
}

-(void)getSelectedSeats:(NSMutableArray *)seats{
    float total=0;
    for (int i=0; i<[seats count]; i++) {
        ZSeat *seat = [seats objectAtIndex:i];
        printf("Seat[%ld,%ld]\n",(long)seat.row,(long)seat.column);
        total += seat.price;
    }
    printf("--------- Total: %f\n",total);
}

Swift
func seatSelected(seat: ZSeat) {
        print("Seat at row: \(seat.row) and column: \(seat.column)\n")
    }
    
func getSelectedSeats(seats: NSMutableArray) {
        var total:Float = 0.0;
        for i in 0..<seats.count {
            let seat:ZSeat  = seats.objectAtIndex(i) as! ZSeat
            print("Seat at row: \(seat.row) and column: \(seat.column)\n")
            total += seat.price
        }
        print("----- Total -----\n")
        print("----- \(total) -----\n")
    }
    

Zooming
Set the zoom as you would with a UIScrollView properties: minimumZoomScale
maximimZoomScale

Hope you find it useful.

Follow me on Twitter @richzertuche

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].