I'm completely new to Objective C and iPhone programming. I ran my code through the debugger and my UITextView called textView appears to return nothing for [textView text] in the sendTransmit method. Does anyone see anything in my code that could be causing it? I left out the irrelevant methods.
I'm using Xcode 4.2 with automatic reference counting.
I'm using Xcode 4.2 with automatic reference counting.
Code:
//ViewController.h file
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
@interface MOViewController : UIViewController <UITextViewDelegate>
{
AVCaptureSession *AVSession;
IBOutlet UITextView *textView;
}
@property (nonatomic, retain) AVCaptureSession *AVSession;
@property (retain, nonatomic) IBOutlet UITextView *textView;
- (IBAction)sendRoger:(id)sender;
- (IBAction)sendTransmit:(id)sender;
// -----------------------------------------
// ViewController.m file
#import "MOController.h"
#import <AVFoundation/AVFoundation.h>
#import <unistd.h>
@implementation MOViewController
@synthesize AVSession;
@synthesize textView;
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
{
if ( [ text isEqualToString: @"\n" ] ) {
[textView resignFirstResponder ];
return NO;
}
return YES;
}
- (IBAction)sendTransmit:(id)sender {
char temp;
for (int i=0; i<[[textView text] length]; i++)
{
// Convert to upper case character
temp = [[[textView text] uppercaseString] characterAtIndex:i];
// Send the character for transmission
[self transmitCharacter: temp];
}
}
Last edited: