drawRect / Instagram_Stories

Inspired by Instagram Stories functionality. This source is similar to Instagram Stories, which is having both image and video support.
MIT License
414 stars 76 forks source link

hi @ranmyfriend #116

Closed ajaychaudharkansal closed 3 years ago

ajaychaudharkansal commented 3 years ago

Facing issue while adding child controller

hi @ranmyfriend

Thanks for your response , I done with the textfield part , now I'm doing something like , when user click on textfield than I want to open child view controller . For that I'm adding child controller on it . for that I'm using this code.

let popVC = controller.storyboard?.instantiateViewController(withIdentifier: "CommentOnMystryStyVC") as? CommentOnMystryStyVC controller.addChild(popVC!) popVC?.view.frame = (controller?.view.frame)! controller?.view.addSubview(popVC!.view) popVC?.didMove(toParent: controller)

But my app is getting crash. Please help me in this. I declare [ var controller: IGStoryPreviewController! ] in IGStoryPreviewCell class , but still getting popVC nil.

Please help me in this . I don't understand what I'm doing wrong in this.

_Originally posted by @ajaychaudharkansal in https://github.com/drawRect/Instagram_Stories/issues/115#issuecomment-692507178_

boominadhaprakash commented 3 years ago

Hi @ajaychaudharkansal

If popVC is nil means you have to check this controller.storyboard?.instantiateViewController(withIdentifier: "CommentOnMystryStyVC") as? CommentOnMystryStyVC code.

Put breakpoint and check each values like, check controller value, check controller.storyboard? value, check controller.storyboard?.instantiateViewController(withIdentifier: "CommentOnMystryStyVC"). If any of the values are nil then only, the popVC gets nil. So, you need to validate that data.

ajaychaudharkansal commented 3 years ago

Thanks for the response , done with this issues.

ajaychaudharkansal commented 3 years ago

Actually I stuck on last point , when I have to remove the child controller than , I have to resume the progress bar by using this code.

let v = self.getProgressView(with: self.snapIndex) v?.resume()

the problem I'm facing here is I'm not able to understand how to call this function .

can you please help me in this .

boominadhaprakash commented 3 years ago

Hi @ajaychaudharkansal

You no need to worry about the v?.resume and all.

In IGStoryPreviewCell, the methods are already available to do this job.

public func pauseEntireSnap() public func resumeEntireSnap()

The above two methods you can find in IGStoryPreview and utilise it.

If you are having cell instance, then you can simply call cell.pauseEntireSnap(), cell.resumeEntireSnap() like this.

ajaychaudharkansal commented 3 years ago

hi @ranmyfriend Thanks for the response. I will check it . I also have one more query . if I want to show text with story than I should I have to do .

ajaychaudharkansal commented 3 years ago

hi @ranmyfriend , Please help me in this , I also want to show text along with images in stories. Please guide me how to do this .

Thanks

ajaychaudharkansal commented 3 years ago

hi @ranmyfriend

I'm waiting for your response . Can you please guide for the points I mentioned you.

boominadhaprakash commented 3 years ago

Hi @ajaychaudharkansal

Don't have idea, you can modify the code as per your wish to achieve your requirement,

ajaychaudharkansal commented 3 years ago

okay Thanks @ranmyfriend . Thanks for the response

ranmyfriend commented 3 years ago

@ajaychaudharkansal Yeah, it's completely based on your requirement. and can you please help us see what exactly you want to do here? and if you have any wireframe or some kind of rough images. please attach here. So that we can confirm it once.

ajaychaudharkansal commented 3 years ago

hi @ranmyfriend Thanks for the response . Please check the attachment.

In this in want to show text along with images. the green view is label .

https://user-images.githubusercontent.com/71260037/93319888-0e47ec00-f82e-11ea-994f-cd46bc949077.png

ranmyfriend commented 3 years ago

@ajaychaudharkansal Got it. This is kind of additional things you are attaching to the IGStory. I mean to say. Image or Video on top of this user can add something to it. This is we have not planned yet. Right now we don't have time to do this. Maybe in future, we will add this feature. You just search for any library or tool which you can implement this.

ajaychaudharkansal commented 3 years ago

@ranmyfriend actually i searched a lot , but didn't find any of the library related to that .

If I want to modify in your code , than can you please tell me in which class I have to do modification.

I add this code in IGStoryPreviewCell

lazy var snapCommentOnImage : UILabel! = { let commentOnImage = UILabel(frame: CGRect(x: 10, y: self.bounds.height/1.5, width: UIScreen.main.bounds.width - 20, height: 30)) commentOnImage.textAlignment = .center commentOnImage.textColor = .red commentOnImage.backgroundColor = .green commentOnImage.font = UIFont.systemFont(ofSize: 25) commentOnImage.numberOfLines = 0 return commentOnImage }()

ajaychaudharkansal commented 3 years ago

hi @ranmyfriend I done this part also . Thanks for very thing. I learned new things in this.

Thanks @ranmyfriend @boominadhaprakash .

ranmyfriend commented 3 years ago

Sounds Great 👍

boominadhaprakash commented 3 years ago

Welcome!!! @ajaychaudharkansal