开发者

calling the protocol methods in objective c

开发者 https://www.devze.com 2023-04-05 07:16 出处:网络
i have used the following protocol in the yyyy.h file of a class @protocol FGalleryViewControllerDelegate

i have used the following protocol in the yyyy.h file of a class

 @protocol FGalleryViewControllerDelegate

    @require开发者_如何转开发d
    - (int)numberOfPhotosForPhotoGallery:(FGalleryViewController*)gallery;
    - (FGalleryPhotoSourceType)photoGallery:(FGalleryViewController*)gallery sourceTypeForPhotoAtIndex:(NSUInteger)index;

    @optional
    - (NSString*)photoGallery:(FGalleryViewController*)gallery captionForPhotoAtIndex:(NSUInteger)index;

    // the photosource must implement one of these methods depending on which FGalleryPhotoSourceType is specified 
    - (NSString*)photoGallery:(FGalleryViewController*)gallery filePathForPhotoSize:(FGalleryPhotoSize)size atIndex:(NSUInteger)index;
    - (NSString*)photoGallery:(FGalleryViewController*)gallery urlForPhotoSize:(FGalleryPhotoSize)size atIndex:(NSUInteger)index;

    @end

and i am calling these methods using the delegate object

NSObject < FGalleryViewControllerDelegate> *_photoSource;

in some other class not in yyy.m,,

now i tried to call these methods in the same class yyy.m,,i used the same delegate object to call the methods but its crashed ,,should i use self to call those?


if you want self to call those then set the @property of this delegate object. and then use it it works.

0

精彩评论

暂无评论...
验证码 换一张
取 消