I am using the Three20 framework to implement a photo viewer. However, I also intend to customize it by doing the following:
1) Add a profile photo on top of each photo displayed and add some text to it (I assume I have to add a subview)
2) Add additional buttons on the side of the photo to allow users to delete or star the photo.
I have looked into the code for TTPhotoViewController but am not sure the place where I can make all these customizations. Do I make the changes to a subclass of photo view? And where exactly in photo view can I do it?
First you have to subclass TTPhotoViewController (see the sample code in TTCatalog). Then make a subclass of TTPhotoView. In this subclass there are a lot of points, where you can add another Image or Label to the PhotoView. I just tested adding a new Label inside the
- (void)showCaption:(NSString*)caption
method and it worked great.
The next step is to override the following method.
- (TTPhotoView*)createPhotoView {
return [[[TTPhotoView alloc] init] autorelease];
}
In this method you can just alloc, init and autrelease your own subclass of TTPhotoView. This way the photo shown in the TTPhotoViewController will be your own custom photo.
I think my answer is a little bit confusing. If you need additional help, just post a comment.
Related
I have created a book which can read the story.
I've used UIPageViewController to add page curl while transitioning from one view to another view.
I want to add this player view to pages, so it would be very realistic. text and soundPlayer have two different controller. and while paging, Im creating new instance of textViewController and adding text to it's label.
if I add player view to textViewController's view, and after paging I remove it from its superview, the player stop playing.
Im confused how to manage this dilemma!!
I've uploaded my code. I appreciate if someone could help me
update:
I could take an screenshot from current state of playerView and add it as subview of textViewController. and set alpha of player = 0 so set it hidden.
after curling the page, I remove the image and set transparency (alpha) of player to 1.
but how can I manage to add this photo on next textViewController too?
as you can see in the below image, it's just set to the current textViewController.
code updated:
http://upload.ugm.ac.id/447paging2.zip
the answer posted here:
how to use static variables in my UIViewController
please download the sample code posted there.
I have two IBActions. In one action I am loading the UIWebview to display a PDF File from my bundle. On clicking the other button the whole UIWebView should get removed from superview.
I have tried using:
[webview removeFromSuperview];
and
webview.hidden=YES;
Neither of these are working. They are hiding my UIWebView for a second, but then it appears again.
Is is
I have created UIWEBVIEW programatically and added the UIWebvieWDelegate in the interface file. But when initializing the UIWebView I didnt set webview.delegate=self; Is it the problem?
have you connected Referencing Outlet to the class's #property in the Interface Builder?
If you don't do it, it would be the a possible reason why you cannot reach the UIWebView in your source code. for your sake, you should check the pointer of webview, if it is nil chronically, there is 100% you have not connected them each other.
I was trying to make a thing like this. The solution that worked for me was to add UIview object as subview to view with the frame of webview and bringing it to top.... When u want to make uiwebview visible, just remove that uiview object from superview.
OK, it seems old question, but also i can see there are almost thousand people have view it, and may have the same problem. so my answer for anyone my have the same issue in the future.
I just been doing something smiler and want to hide the web view when at a certain action.
I have tried the following
-(void)viewDidLoad
{
[super viewDidLoad];
process = [ProcessingData new];
[DetailView setHidden:YES];
DetailView.hidden = YES;
[DetailView removeFromSuperview];
self.DetailView = nil;
}
however it is still not working, as i have few labels in the WebView which are don't disappear when the view load, when I looked at the "StoryBoard" i notes that the labels are not subview of the
can u see the hierarchy of the libels under the WebView, they are subview of the main view, where they suppose to be same as the table view hierarchy
so in may case the WebView is hiding but the labels are not as they are not a part of the Webview.
how to sort this problem, if you really don't need web view use the normal one, otherwise you have to hide all the labels in that view. hope thats helpe
I don't know obj-c but still posting a solution that worked for me in swift. basically you have to use the main thread to remove the webview.
DispatchQueue.main.async {
print("\nremoving webview\n")
self.myWebView.stringByEvaluatingJavaScript(from: "document.body.innerHTML='';")
self.myWebView.removeFromSuperview()
}
I could use some clarification regarding where these references come from. As an experiment, I set up a split view controller in my application. When the delegate methods are called, they reference what appears to be a valid UIButtonBarItem and a valid UIPopoverController. I say "apparently" because both of these have non-nil values and resolve to the appropriate class (UIButtonBarItem and UIPopoverController). I did not allocate or initialize either one. Am I supposed to?
I don't see anything in the reference documentation that requires that I initialize these programmatically or says how it should be done. I also don't see where the toolbar that contains the UIButtonBarItem is referred to. I haven't found any examples of tutorials that address this detail more than superficially. If someone can explain or provide a reference to an explanation, that would be helpful.
I am working out how to switch from split view to popover view when going into the portrait orientation. I want simply link an existing button to code that does what the UIButtonBarItem would do. I have a small banner view of my own that serves as a toolbar, and I would rather adapt the button in that to work with the split view controller, if I can.
The UISplitViewController creates both of these for you and you can do with them what you want. Just add the button that it provides you to your toolbar and store a reference to the popover (so that you can dismiss it, etc.).
Note that when you go back into landscape mode you need to set your popover variable to nil and remove your button since they are no longer valid.
I want to replicate apple's default mail composer for my app. I don't want to use default mailcomposer because I'm having a lot of other things. Does anybody have solution for this? Main thing I want to implement is attachments. Like when you select a image and tap on email on photos app. The image preview is displayed in body part and also we can enter text and the cursor also detects the image when you press return or back. That functionality I want to achieve.
The TTMessageComposer in the Three20 library is a good start... it doesn't have attachment support but will save you time on the standard layout.
Three20 library
Check out this source code https://github.com/thermogl/TITokenFieldView, it's a custom UI class for token fields but there is a exact replica of Apple's mail UITextView. Heres a snippet from the source. All you have to do is create an normal text view and add it to your view.
// Creating the text view
messageView = [[UITextView alloc] initWithFrame:yourView.contentView.bounds];
// Adding it as a subview
[yourView.contentView addSubview:messageView];
// Set the frame so it resizes with the view.
[messageView setFrame:yourView.contentView.bounds];
I've got an Custom UIButton. It's got
a "static" background image
a variable text (the Title) which gets set in the code
Now I would like to add an icon (UIImage/UIImageView) inside the button on the left of the text. (I use the indent to move the text slightly to the right). Is there an easy way of adding that icon (and referencing it from code, so I can change it) or would you recommend creating a completely new button e.g. based on a UIView? (e.g. a view, that responds to touches)?
I'm just trying to get a feel for what the best approach would be for this. Any experience?
Two ways:
I prefer doing this by subclassing a UIView and (as you mention) implement the UITouch-responder methods. You're also able to override drawRect: what I really like because it makes your app soooooo much faster!
Since UIButton is a subclass of UIView, you can add a UIImageView to your button by using addSubview:. If you save it in your main-class (#property (...) UIButton *button) you can always access it by calling [self button]. You can also subclass your UIButton and add this #property. That's up to you.
It's totally up to you. However I prefer the first way!