Replicate apple's mailComposer UITextView? - objective-c

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];

Related

10.10 Source List that goes through TitleBar?

Just curious about how to accomplish this kind of custom columned app view. The source list goes straight through the titlebar but just on one side, I'm guessing that they hid the titlebar, maybe and then used an NSVisualEffectView? Any source code or tips are appreciated, its a pretty cool and from what I am seeing fairly widely used UI Element for Yosemite Apps.
The Search Bar in this photo and the Add List button are obviously in different views and I totally understand that an NSOutlineView with a SourceList style will automatically create this kind of effect in 10.10 but the button and the search field can't be in the source list scroll area yet their background is consistent with that of the source list which makes me think this effect is more view based than source list based.
Ok, so I answered this myself. I created a github repository here to show others how to easily create the effect that I was looking to create.
Tri-Transarent-Window
The basic gist is to create a NSVisualEffectsView and then simply hide the titlebar and set the titlebar mask.
#implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
self.window.styleMask = self.window.styleMask | NSFullSizeContentViewWindowMask;
self.window.titleVisibility = NSWindowTitleHidden;
self.window.titlebarAppearsTransparent = YES;
}
The above code will make the window accept the view and it will auto bleed through the titlebar. Here is my XIB
When you run you get a nice sidebar style transparent view that extends through the titlebar.

Objective-C - Making an image link

The thing is that I'm rather new to Objective-C and have been reading about it now for a few days online. I started to create a simple iOS application but I didn't find anything about this when I Googled it.
Now I want to create a link that is not plain text, but an image.
If this is incomprehensible, then this is how I would do it in HTML:
<img src="IMAGE.png"/>
So far in my ViewController.h, I have:
-(IBAction)link;
And in my ViewController.m, I have:
-(IBAction)link {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://www.google.com/"]];
}
How would I link this URL to an image?
Cheers.
There's a simple way to do that. You can add a button on top of the image and make the button send actions to the view controller, or you can link it to -(IBAction)link; directly.
Add a UIButton in IB/Storyboard to your view.
Make that button of the same size that your image is.
Assing the image as the buttons image or background image.
Connect the touch up inside event with the IBAction link.
Or do you want to do that programmatically?

UIImageView in PopOver not changing?

I'm making an app and it has multiple button that when you press them it open a pop over view (using Storyboard.) The image is blank in IB (I set it that way) and my buttons are ment to populate the image view. This is the code I'm using:
[popoverImageView setImage:[UIImage imageNamed:#"telegraph.jpeg"]];
Steps (in order run)
Popover opens
Above code is run
Some notes:
The image is case matched.
The image is built-into the bundle
Anyone able to shed some light?
if you haven't read Apples View Controller Catalog for iOS you should read it.
I would check your popoverImageView's viewDidLoad/viewWillLoad and see if it is clearing your View before it presents itself.
Check your popoverImageView's properties they may not be linked properly
Enjoy using the storyboard I find it a pain for Popover's
Without any information regarding the the interface for your Popover and the implementation of the function where you call [popoverImageView setImage:[UIImage imageNamed:#"telegraph.jpeg"]]; and your setImage function i can't be sure of your exact problem

iOS UITableViewController cells data filling

Two questions:
I am trying to build a app that has a table view. I would like the user to click on a topic and then the next table view has a image on the left and text on the right. Does anyone know any sample code that would help me accomplish this?
Example:
iPad --> WiFi, and WiFi + 3G
iPhone --> AT&T, Verizon
Also is their a way to tag images in xCode? So in my table view I can only pull images with tag "x"?
Check out http://developer.apple.com/library/ios/#samplecode/TableViewSuite/Introduction/Intro.html for sample code on how to implement table views.
I don't understand your question about tagging. You can use [UIImage imageNamed:] to pull in images that are bundled in your app. Name them as you will.
See Dispelling the UIImage imageNamed: FUD for a discussion of this method.
First of all make a navigation based app. This gives you an app with a view controller in place with a table view on the screen.
Take a look at these for more info:
UITableViewController Class Reference
UITableViewCell Class Reference
In this last one take a look at initWithStyle:reuseIdentifier:, this will allow you to use the style you need, if you have default and add a picture to this cell it will show in the left side, pushing the text a little to the right.
For tagging an image you can simply do
image.tag = tagNumber;
For the cell image you can have like this:
image.tag = tagNumber;
cell.imageView.image = image;

Add additional UIImage to TTPhotoViewController

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.