I'm trying to take the output of arc4sin and put it into a label.
(EDIT: You can ignore this and just post sample code, if this is too irrelevant.)
I've tried:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
NSString *number = [[NSString alloc] stringWithFormat: @"%@", arc4random() % 9];
label.text = number;
}
I've created an IBOutlet for "label" and connected it. What's wrong here?
How can you map say, a square or circle, to a triangle in OpenGL without distortion? I'm not seeing it.
EDIT:
Bonus question: What are some good OpenGL ES tutorials online? Videos and articles count. (I've seen the Stanford University stuff on iTunes U and think it's excellent, but I want more.)
1) How do I make a UITextField resign the keyboard and hide it? The keyboard is in a dynamically created subview whose superview looks for shake events. Resigning first responder seems to break the shake event handler.
2) how do you make the view holding the keyboard transparent, like see through glass? I have seen this done before. This part has been taken care of thanks guys.
As always, code samples are appreciated. I've added my own to help explain the problem.
EDIT:
Basically, - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event; gets called in my main view controller to handle shaking.
When a user taps on the "edit" icon (a pen, in the bottom of the screen - not the traditional UINavigationBar edit button), the main view adds a subview to itself and animates it on to the screen using a custom animation.
This subview contains a UINavigationController which holds a UITableView. The UITableView, when a cell is tapped on, loads a subview into itself. This second subview is the culprit. For some reason, a UITextField in this second subview is causing problems.
When a user taps on the view, the main view will not respond to shakes unless the UITextField is active (in editing mode?).
Additional info:
My Motion Event Handler:
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
NSLog(@"%@", [event description]);
SystemSoundID SoundID;
NSString *soundFile = [[NSBundle mainBundle] pathForResource:@"shake" ofType:@"aif"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:soundFile], &SoundID);
AudioServicesPlayAlertSound(SoundID);
[self genRandom:TRUE];
}
The genRandom: Method:
/* Generate random label and apply it */
-(void)genRandom:(BOOL)deviceWasShaken{
if(deviceWasShaken == TRUE){
decisionText.text = [NSString stringWithFormat: (@"%@", [shakeReplies objectAtIndex:(arc4random() % [shakeReplies count])])];
}else{
SystemSoundID SoundID;
NSString *soundFile = [[NSBundle mainBundle] pathForResource:@"string" ofType:@"aif"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:soundFile], &SoundID);
AudioServicesPlayAlertSound(SoundID);
decisionText.text = [NSString stringWithFormat: (@"%@", [pokeReplies objectAtIndex:(arc4random() % [pokeReplies count])])];
}
}
shakeReplies and pokeReplies are both NSArrays of strings. One is used for when a certain part of the screen is poked and one is for when the device is shaken. The app will randomly choose a string from the NSArray and display onscreen.
For those of you who work graphically, here is a diagram of the view hierarchy:
Root View -> UINavigationController -> UITableView -> Edit View -> Problem UITextfield
Where would I find a list of locale name abbreviations for my project localization folders? (Such as en for English, fr for French).
I am looking to do German, Spanish and others.
I'm writing an iPad app that is a "kiosk" app. The iPad should be hanging on the wall and the app should just run. I did a test, starting the app last night (Friday, December 31) and letting it run. This morning, when I woke up, it was not running. I just checked the iPad's console and I can't figure out why it crashed.
The iPad was plugged in and so the battery is not the issued. I did disable the idleTimer in my application delegate. The app was seen running as late as midnight last night.
I would like to note that my app acts as a Bluetooth server through Game Kit and large portion of the console output is occupied by bluetooth status messages.
When I opened the iPad, the app was paused and there was a system alert which prompted me to check an "Expiring Provisioning Profile". I tapped "dismiss" and the alert went away. The app crashed about a second after I dismissed the system alert.
Any ideas how I can diagnose this problem? Why would my app crash?
Here is my iPad's Console log, as copied from Xcode's organizer.
Edit:
A bit of Googling lead me to this site which says that alert views cause the app to lose focus. Could that be involved? What can I do to fix the problem?
EDIT2:
My Crash log describes the situation as:
Application Specific Information:
appname failed to resume in time
Elapsed total CPU time (seconds): 10.010 (user 8.070, system 1.940), 100% CPU
Elapsed application CPU time (seconds): 9.470, 95% CPU
i want to use a segmented control instead of a UITabBar controller to change the view. Is that in accordance with the HIG?
If yes, how can I do so? What template should I use for my project and what code?
Hey,
Say i set my log4net logger's minLevel and maxLevel to FATAL and DEBUG respectively, but under some scenario i want to mute the log-items written in the WARN level, and keep all the other levels in the range active.
Is it possible to somehow use 'discrete' levels of log-levels rather than specifying a range using minLevel and maxLevel?
I assume this should be simple, but i haven't found any log4net docs or examples dealing with this issue.
Regards,
Harel
XCode 3.2.3 Beta does not allow building for below 3.2.
I opened a project that was made in an earlier XCode.
For some reason, the base SDK is reported as missing even after changing it to 4.0.
Other projects from earlier XCode do not have this issue.
What can I do?
I've added the appropriate XML to my PLIST ("audio key") and my app did stream audio in the background.
I installed the app on to an iPhone 3GS running iOS 4 via Ad Hoc distribution. I played audio in my app and pressed the home key. It was still playing.
Then I switched computers and reset my provisioning profile. I recompiled and exported with a generic provisioning profile. I sent the app to someone else to test on their 3GS via Ad Hoc and the app does not work in the background.
Background:
I'm new to Objective-C and I've never touched C before. I'm trying to include a C library in my iPhone/iPod Touch project and I could not successfully compile the library's source code using the included instructions, so I've resorted to including the .h and .c files in Xcode. The library is for Hebrew Dates and corresponding Jewish Holidays. It can be found here: http://sourceforge.net/projects/libhdate/
I cannot seem to import the .c files into my implementation files. I can import the .h files though. When I try to use #import "file.c", where file.c is a file that is in XCode, it doesn't work. Why not?
I've considered just writing the functions over in Objective-C, albeit only my needed functions and not the whole library.
How can I make the following C function work in Objective-C? Are there other things that need to be included/re-coded/compiled? How so? I am almost certain something is missing, but I'm not sure what.
Code:
int hdate_get_omer_day(hdate_struct const * h)
{
int omer_day;
hdate_struct sixteen_nissan;
hdate_set_hdate(&sixteen_nissan, 16, 7, h->hd_year);
omer_day = h->hd_jd - sixteen_nissan.hd_jd + 1;
if ((omer_day > 49) || (omer_day < 0))
omer_day = 0;
return omer_day;
}
So... should I be converting it, or trying somehow to compile to an appropriate format and how so? (I don't know what format a static library should be in, by the way, or if it should be static... - I'm so lost here....)
I appreciate the help!
I'm writing a shell for a project of mine, which by design parses commands that looks like this:
COMMAND_NAME ARG1="Long Value" ARG2=123 [email protected]
My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the arguments. This behavior doesn't match my requirements.
Any ideas how can this be solved? Any existing library for this?
I want to make a TableView of phrases which the user can edit. The "Phrase editor" is being displayed modally. My top left is for the Done button right now. I'm considering making a button at the end of the table for "new phrase".
How would I implement that?
Is it a good idea to follow the "contacts" application and make a + button in the top right, or Should I make the "Add Items" button at the end of the list? What are HIG implications of either one?
BONUS: Where can I find some tutorials on Navigation Controllers and Table Views?
Thanks a ton.
I have a function which takes a custom struct as the argument. how can I figure out what the argument should be? I know it is a date format of sorts... (C library imported to Objective-C...)
I am having trouble understanding my iPhone app sales report. Which column says how many downloads I have? Which report should I use?
I am asking here because only developers would understand what I am talking about. Nobody else sees these reports.
I'm making a simple form which has 5 input elements for parts of an address. I use jQuery to build and send an AJAX request to a PHP file on my server. For some reason my jQuery is not properly able to read the values from my input elements. What could be wrong?
Here is my jQuery:
$('#submitButton').click(function(){
$('#BBRequestBox').html('<img src="images/loading.gif" />');
alert('Info: ' + $('#name').val() + ' ' + $('#street').val() + ' ' + $('#city').val() + ' ' + $('#state').val() + ' ' + $('#zip').val() + ' ');
$.ajax({
type: "POST",
url: "./bbrequest.php",
data: {name: $('#name').val(), street: $('#street').val(), city: $('#city').val(), state: $('#state').val(), zip: $('#zip').val() },
success: function(msg){
$('#BBRequestBox').html('<p>' + msg + '</p>');
},
error: function(XMLHttpRequest, textStatus, errorThrown){
$('#BBRequestBox').html('<p> There\'s been an error: ' + errorThrown + '</p>');
}
});
return false;
});
Here is my HTML:
<form action="#">
<label>Name:</label><input type="text" id="name" class="textbox"/>
<label>Street:</label><input type="text" id="street" class="textbox" />
<label>City:</label><input type="text" id="city"class="textbox" />
<label>State:</label><input type="text" id="state" class="textbox"/>
<label>Zip:</label><input type="text" id="zip" class="textbox" />
<input type="submit" value="Send Me a Bitachon Builder!" id="submitButton" />
</form>
In Objective-C, I've seen, for example:
UIPickerView *tweetPicker
and
UIPickerView* tweetPicker
What does the asterisk mean (I know, the first part is a dupe...) and why does it go on different parts of the deceleration in different contexts?
Hi,
If I do this:
1 NSMutableArray *near = [[NSMutableArray alloc] init];
2 NSMutableArray *all = [[NSMutableArray alloc] init];
3 NSMutableArray *current = near;
4 current = all;
What happens to near?
At line 3, am I setting current to point to the same address as near so that I now have two variables pointing to the same place in memory, or am I setting current to point to the location of near in memory such that I now have this structure:
current - near - NSMutableArray
The obvious difference would be the value of near at line 4. If the former is happening, near is untouched and still points to its initial place in memory. If the latter is happening,
I know that javascript, for example supports functions inside of functions, like so:
function doSomething(){
function doAnothingThing(){
//this function is redefined every time doSomething() is called and only exists inside doSomething()
}
//you can also stick it inside of conditions
if(yes){
function doSomethingElse(){
//this function only exists if yes is true
}
}
}
Does objective-c support this? Theoretical example:
-(void) doSomething:(id) sender{
-(void) respondToEvent: (id) sender{
//theoretically? ... please?
}
}
BONUS: What is the proper term for a "local" function?
I want to allow my user to store custom phrases, to be displayed in an editable UITableView.
What's a quick and dirty to store these strings?
I'm fairly new at iPhone development. I know about Core Data, but not how to use it. i would stay away form that just for this particular project if possible. Are PLIST files a possibility here?
Sample code is appreciated.
Thank you.
Where would I find a list of locale name abbreviations for my project localization folders? (Such as en for English, fr for French).
I am looking to do German, Spanish and others.
I know iPhone development fairly well. From personal experience, how hard would it be for me to get into Android. I am concerned less about code than I am about distribution of my software, given the fragmentation of the Android OS on compatible devices.