Skip to content

Instantly share code, notes, and snippets.

View spraveenk91's full-sized avatar
💻

Praveenkumar S spraveenk91

💻
View GitHub Profile
class CardView: UIView {
@IBOutlet weak var title: UILabel!
@IBOutlet weak var image: UIImageView!
@IBOutlet weak var collectionView: UICollectionView!
func setupCardView() {
.....
}
override func layoutSubviews() {
fileprivate let people: BehaviorRelay<[Person]> = BehaviorRelay(value: [
Person(name: "Spiderman", title: "Marvel"),
Person(name: "Batman", title: "DC"),
Person(name: "Mickey", title: "Disney")
])
let disposeBag = DisposeBag()
Incident Identifier: C28260B4-DECA-419E-BC49-770D7701708C
CrashReporter Key: 05b2264055702abdd411424db738dcfc3b5b983b
Hardware Model: iPhone8,2
Process: MyApplicationName [412]
Path: /private/var/containers/Bundle/Application/772F232F-AC65-4467-AFEA-A989A812D406/MyApplicationName.app/MyApplicationName
@protocol BaseDelegate <NSObject>
@required
- (void)didSelectActionSheetIndex:(NSString *)actionTitle actionSheetIndex:(NSInteger )index;
@end
@interface CustomAction : NSObject <UIActionSheetDelegate>
@property (nonatomic, assign) id<BaseDelegate> delegate; // Assign property
1. FirstViewController will show one ActionSheet and its action perform here by UIActionSheetDelegate. Before, presenting this action sheet i am setting the delegate to my CustomAction class
- (void)cellMenuClicked:(id)sender {
CustomAction *obj = [[CustomAction alloc] init];
obj.delegate = self;
thumbActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:obj cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Add to Watchlist", @"Share", nil];
[thumbActionSheet showInView:[self.view window]];
}
@spraveenk91
spraveenk91 / ActionSheet
Last active August 29, 2015 14:08
Flow
CustomAction.h
--------------
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@protocol BaseDelegate <NSObject>
@required
- (void)didSelectActionSheetIndex:(NSString *)actionTitle actionSheetIndex:(NSInteger )index;
@spraveenk91
spraveenk91 / FirstViewController.m
Last active August 29, 2015 14:08
FirstViewController Main File
//
// FirstViewController.m
//
// Created by Work on 19/09/14.
// Copyright (c) 2014 App. All rights reserved.
//
#import "FirstViewController.h"
@interface FirstViewController () <BaseDelegate> // Delegate
@spraveenk91
spraveenk91 / FirstViewController.h
Created October 30, 2014 13:07
FirstViewController Header File
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
@interface FirstViewController : BaseViewController <UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate, UIActionSheetDelegate>
...
@end
@spraveenk91
spraveenk91 / BaseViewController.m
Created October 30, 2014 10:05
BaseViewController Main File
//
// BaseViewController.m
//
// Created by Work on 22/09/14.
// Copyright (c) 2014 E. All rights reserved.
//
#import "BaseViewController.h"
#import "GlobalInstance.h"
#import "CDRTranslucentSideBar.h"
@spraveenk91
spraveenk91 / BaseViewController.h
Created October 30, 2014 09:58
BaseViewController Header File
#import <UIKit/UIKit.h>
#import "GlobalInstance.h"
@protocol BaseDelegate <NSObject>
@required
- (void)didSelectActionSheetIndex:(NSString *)actionTitle actionSheetIndex:(NSInteger )index;
@end