weilsonwonder / WWCalendarTimeSelector

A android inspired iOS date/time picker
MIT License
317 stars 126 forks source link

optionStyles not found. #4

Closed souravbajlur closed 8 years ago

souravbajlur commented 8 years ago

I am using this Calendar in my Objective C project. I just want to show the Calendar with Date and Year once and with the Time once. But i can't find any property for this. Can Any one help me out. @weilsonwonder . Thanks in advance

weilsonwonder commented 8 years ago

@souravbajlur I have updated the pod, will update the readme in time to come.

bintu1234 commented 7 years ago

@souravbajlur Hi how your using this Lib in objective c, please help me.

souravbajlur commented 7 years ago

hello @bintu1234 , You have to use Bridging header and import like:

@import WWCalendarTimeSelector;

and also you have add the bridging header file name to the info.plist file in Swift Compiler - General portion like:

Objective C Bridging Header {your_project_name}/{Bridging_Header_File_Name.h} If you need more help to understand, feel free to ask. thanks.

bintu1234 commented 7 years ago

@souravbajlur Thank you very much i will try.

bintu1234 commented 7 years ago

@souravbajlur I think you talking about Obj-C file into swift,But i need swift file into Objc. am i right?

souravbajlur commented 7 years ago

@bintu1234 , no, you are wrong. I am talking about using swift file into Objective C. I have used this beautiful calendar to my Objective C project. If you don't familiar with using swift file into Objective C project then please first go through this. Then follow the instruction i have given before. Hope you can use this calendar. Thanks.

bintu1234 commented 7 years ago

@souravbajlur Thanks yes first i will search for that.

bintu1234 commented 7 years ago

@souravbajlur Sorry for bothering,now i am able to run with swift lib,But now i need to add bridging header file but now i am getting this error Unknown class _TtC38WWCalendarTimeSelectorStoryboardBundle22WWCalendarTimeSelector in Interface Builder file. Could not cast value of type 'UIViewController' (0x10e6dbdd8) to 'WWCalendarTimeSelector.WWCalendarTimeSelector' (0x10aeaa048).

souravbajlur commented 7 years ago

@bintu1234 , don't be sorry, you are always welcome to ask question. :) I am describing the process in details. Hope you understand.

  1. Go to Build Settings and do the followings: Defines Module : YES Embedded Content Contains Swift : YES Install Objective-C Compatibility Header : YES Objective-C Bridging Header : $(SRCROOT)/Sources/BridgingHeaderFileName.h // previously i was saying to add in info.plist by mistake. sorry for that. :(
  2. Add pod 'WWCalendarTimeSelector' to your podfile and install podfile.
  3. Create a header file like: BridgingHeaderFileName.h (Name format like that is not mandatory)
  4. Import WWCalendarTimeSelector to the bridge header file like: @import WWCalendarTimeSelector;
  5. Import bridge header file to your viewcontroller file like: #import "BridgingHeaderFileName.h"
  6. Add delegate to viewcontroller like:
  7. Declare a property of WWCalendarTimeSelector to the viewcontroller like: @property (nonatomic, retain) WWCalendarTimeSelector *WWDate;
  8. Then show the calendar when you want to show like: WWDate = [WWCalendarTimeSelector instantiate]; // If you want to show the month and year view [WWDate.optionStyles showDateMonth:YES]; [WWDate.optionStyles showYear:YES]; [WWDate.optionStyles showTime:NO];
        WWDate.delegate = self;
        WWDate.optionCurrentDate = [NSDate date];
        [self presentViewController:WWDate animated:YES completion:nil];

Hope you can use the calendar now. :)

bintu1234 commented 7 years ago

@souravbajlur thanks for the replay i just found solution.Now it is looking nice .But what i have done is

  1. first i installed pods. 2.then i created one header file and named as you said.
  2. i imported like @import WWCalendarTimeSelector; . and Embedded Content Contains Swift : YES Install Objective-C Compatibility Header : YES. Thats it now it is working. is this Ok?i am asking for future purpose like app strore submition time. and last but not least Thanks for every thing .
souravbajlur commented 7 years ago

@bintu1234 ,You are most welcome. And i think there will be no problem on app store submission, it's like other third party library we use. If you face any problem on that for this library, you should consult with @weilsonwonder .

bintu1234 commented 7 years ago

@souravbajlur Ok ,and last thing if i open this in xcode 8 working fine,But if i open in xcode 7.3.1 it is showing plenty of errors.any Reason?

dhanunjaykumar commented 6 years ago

Even i am facing the "Could not cast value of type 'UIViewController' to 'WWCalendarTimeSelector.WWCalendarTimeSelector' #20" did anyone find any solution?