{"id":13990271,"url":"https://github.com/richzertuche/ZSeatSelector","last_synced_at":"2025-07-22T12:31:25.660Z","repository":{"id":35700067,"uuid":"39977360","full_name":"richzertuche/ZSeatSelector","owner":"richzertuche","description":"Create a Seat Map Layout ","archived":false,"fork":false,"pushed_at":"2017-04-01T15:06:54.000Z","size":174,"stargazers_count":526,"open_issues_count":3,"forks_count":73,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-29T09:40:34.174Z","etag":null,"topics":["cinema","objective-c","plane","seats","swift","uiscrollview"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richzertuche.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-30T23:47:36.000Z","updated_at":"2024-08-25T21:23:16.000Z","dependencies_parsed_at":"2022-09-07T02:02:56.749Z","dependency_job_id":null,"html_url":"https://github.com/richzertuche/ZSeatSelector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/richzertuche/ZSeatSelector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richzertuche%2FZSeatSelector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richzertuche%2FZSeatSelector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richzertuche%2FZSeatSelector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richzertuche%2FZSeatSelector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richzertuche","download_url":"https://codeload.github.com/richzertuche/ZSeatSelector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richzertuche%2FZSeatSelector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266495981,"owners_count":23938640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cinema","objective-c","plane","seats","swift","uiscrollview"],"created_at":"2024-08-09T13:02:31.292Z","updated_at":"2025-07-22T12:31:20.637Z","avatar_url":"https://github.com/richzertuche.png","language":"Objective-C","funding_links":[],"categories":["Objective-C"],"sub_categories":[],"readme":"# ZSeatSelector\n\n\u003ch6\u003eObjective-C \u0026 Swift / Create a Seat Map Layout\u003c/h6\u003e\n\n![alt tag](http://i59.tinypic.com/2enawbc.png)\n\n**You need to import ZSeatSelector and ZSeat. Also add the ZSeatSelector Delegate to your Controller:**\n\n\n\u003ch6\u003eObj-C\u003c/h6\u003e\n\n```obj-c\n\n#import \"ZSeatSelector.h\"\n#import \"ZSeat.h\"\n\n@interface ViewController : UIViewController \u003cZSeatSelectorDelegate\u003e{\n}\n\n```\n\u003ch6\u003eSwift\u003c/h6\u003e\n\n```swift\n\nclass ViewController: UIViewController, ZSeatSelectorDelegate {\n}\n\n```\n\n\u003cbr\u003e\n**Create your map using a NSString.**\n\u003cbr\u003e\n\nNote:\n\u003cbr\u003e\nA = Available\n\u003cbr\u003e\nU = Unavailable\n\u003cbr\u003e\nD = Disabled\n\u003cbr\u003e\n_ = Space\n\u003cbr\u003e\n/ = Line Break (row)\n\n\u003ch6\u003eObj-C\u003c/h6\u003e\n\n```obj-c\n\nNSString *map =     @\"AAAAA_DAAAA/\"\n                    @\"UAAAA_DAAAA/\"\n                    @\"UUUUU_DAAAA/\"\n                    @\"UAAAA_AAAAA/\"\n                    @\"AAAAA_AAAAA/\";\n```\n\n\u003ch6\u003eSwift\u003c/h6\u003e\n\n```Swift\n\nlet map2:String =   \"_DDDDDD_DDDDDD_DDDDDDDD_/\" +\n                    \"_AAAAAA_AAAAAA_DUUUAAAA_/\" +\n                    \"________________________/\" +\n                    \"_AAAAAUUAAAUAAAAUAAAAAAA/\" +\n                    \"_UAAUUUUUUUUUUUUUUUAAAAA/\" +\n                    \"_AAAAAAAAAAAUUUUUUUAAAAA/\" +\n                    \"_AAAAAAAAUAAAAUUUUAAAAAA/\" +\n                    \"_AAAAAUUUAUAUAUAUUUAAAAA/\"\n```\n\n\u003cbr\u003e\n**Create a ZSeatSelector Object as a UIScrollView** \u003cbr\u003e\nSet Seat Size \n\u003cbr\u003e\nSet Images\n\u003cbr\u003e\nSet Seat Price\n\u003cbr\u003e\nFinally Set Map\n\u003cbr\u003e\n\n\u003ch6\u003eObj-C\u003c/h6\u003e\n\n```obj-c\n\nZSeatSelector *seat = [[ZSeatSelector alloc]initWithFrame:CGRectMake(0, 30, self.view.frame.size.width, 160)];\n    \n    [seat setSeatSize:CGSizeMake(32, 32)];\n    [seat setAvailableImage:[UIImage imageNamed:@\"A\"]\n        andUnavailableImage:[UIImage imageNamed:@\"U\"]\n           andDisabledImage:[UIImage imageNamed:@\"D\"]\n           andSelectedImage:[UIImage imageNamed:@\"S\"]];\n    [seat setSeat_price:30];\n    [seat setMap:map];\n    [seat setDelegate:self];\n```\n    \n\u003ch6\u003eSwift\u003c/h6\u003e\n\n```swift\nlet seats2 = ZSeatSelector()\n        seats2.frame = CGRectMake(0, 250, self.view.frame.size.width, 200)\n        seats2.setSeatSize(CGSize(width: 30, height: 30))\n        seats2.setAvailableImage(   UIImage(named: \"A\")!,\n            andUnavailableImage:    UIImage(named: \"U\")!,\n            andDisabledImage:       UIImage(named: \"D\")!,\n            andSelectedImage:       UIImage(named: \"S\")!)\n        seats2.setMap(map2)\n        seats2.seat_price = 5.0\n        seats2.selected_seat_limit = 5\n        seats2.seatSelectorDelegate = self\n        self.view.addSubview(seats2)\n```\n        \n\u003cbr\u003e\n**Seat Limit** \n\u003cbr\u003e\nYou 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\n\n\u003ch6\u003eObj-C\u003c/h6\u003e\n\n```obj-c\n\n    [seat setSelected_seat_limit:3];\n    \n```\n\n\u003ch6\u003eSwift\u003c/h6\u003e\n\n```swift\n\n    seats2.selected_seat_limit = 5\n    \n```\n\n**Add the delegate functions**\n\u003cbr\u003e\n\n\u003ch6\u003eObj-C\u003c/h6\u003e\n\n```obj-c\n\n- (void)seatSelected:(ZSeat *)seat{\n    NSLog(@\"Seat at Row:%ld and Column:%ld\", (long)seat.row,(long)seat.column);\n}\n\n```\n\n```obj-c\n\n-(void)getSelectedSeats:(NSMutableArray *)seats{\n    float total=0;\n    for (int i=0; i\u003c[seats count]; i++) {\n        ZSeat *seat = [seats objectAtIndex:i];\n        printf(\"Seat[%ld,%ld]\\n\",(long)seat.row,(long)seat.column);\n        total += seat.price;\n    }\n    printf(\"--------- Total: %f\\n\",total);\n}\n\n```\n\n\u003ch6\u003eSwift\u003c/h6\u003e\n\n```swift\n\nfunc seatSelected(seat: ZSeat) {\n        print(\"Seat at row: \\(seat.row) and column: \\(seat.column)\\n\")\n    }\n    \n```\n\n```swift\n\nfunc getSelectedSeats(seats: NSMutableArray) {\n        var total:Float = 0.0;\n        for i in 0..\u003cseats.count {\n            let seat:ZSeat  = seats.objectAtIndex(i) as! ZSeat\n            print(\"Seat at row: \\(seat.row) and column: \\(seat.column)\\n\")\n            total += seat.price\n        }\n        print(\"----- Total -----\\n\")\n        print(\"----- \\(total) -----\\n\")\n    }\n    \n```\n**Zooming**\n\u003cbr\u003e\nSet the zoom as you would with a UIScrollView properties:\nminimumZoomScale\u003cbr\u003e\nmaximimZoomScale\u003cbr\u003e\n\n\nHope you find it useful.\n\u003cbr\u003e\n\u003cp\u003eFollow me on Twitter \u003ca href=\"https://www.twitter.com/richzertuche\" target=\"_blank\"\u003e @richzertuche\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichzertuche%2FZSeatSelector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichzertuche%2FZSeatSelector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichzertuche%2FZSeatSelector/lists"}