Unable to build initWithStyle method... [closed] - objective-c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have an iPad app, built in XCode4.5, using Storyboards and iOS6. I have a UITableView that I am trying to fill from a CoreData store using MagicalRecord. This is the piece of my code that's giving me problems:
- (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:<#style#> reuseIdentifier:reuseIdentifier]; // <--
if(self) {
// initialization code
}
return self;
}
I'm getting a build error (on the line with the // <--) saying "expected expression". I have looked in SO, Google and absolutely can not figure this out! (I have the same code running in another app with no problems).
Can someone please tell me how to correct this?

Well I don't know if that was a paste mistake or whatever, buu should write it this way:
self = [super initWithStyle: style reuseIdentifier:reuseIdentifier];

Related

How to use UIWebView? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a UIWebView in my application.
I have no clue how to use it. I'm no Objective-C expert, and Objective-C documentation seems to be lacking. Could someone please explain to me the steps and code to do this?
I have it already in my view, but I don't know whether to make it an IBOutlet, or something else. Thanks.
but I don't know whether to make it an Outlet
You should add an IBOutlet for your UIWebView because you need to tell it to load which web page.
Then you can use it like this:
// remember to add the 'http://' or `https://`
NSURL * url = [NSURL URLWithString:#"http://www.google.com"];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:req];
Sometimes maybe you need to set webView's delegate method:
– webView:shouldStartLoadWithRequest:navigationType:
– webViewDidStartLoad:
– webViewDidFinishLoad:
– webView:didFailLoadWithError:
#interface RadioViewController : UIViewController<UIWebViewDelegate>
...
#end
And set its delegate to self.
self.webView.delegate = self;
And add this method to do something you need.
- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
// Add your code
}

Use uislider to control alpha in uitextview [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How can I use uislider to control alpha in uitextview?
Please provide code.
Thanks a lot.
If you have some class with instance variables _yourTextView and _yourSlider, use:
_yourSlider.minimumValue = 0;
_yourSlider.maximumValue = 1;
_yourSlider.value = 0.0;
[_yourSlider addTarget:self action:#selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
And then, in the same class, define function:
- (void)sliderValueChanged:(UISlider *)sender {
_yourTextView.alpha = sender.value;
}
The definition of UISlider and UITextView,i believe, you can do by yourself.

Changing all table cell properties from appDelegate [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have several UITableViews and what I would like to do is to be able to change the properties of those UITableViews from a single class, which is the AppDelegate class.
Does anyone know if it would be possible to do so?
If You are using iOS5 then you can use UIAppearance
//For example this changes the background color of all UITableViews contained in a UIView
[[UITableView appearanceWhenContainedIn:[UIView class], nil] setBackgroundColor:[UIColor greenColor]];

NSArrayController - add: & remove: programmatically [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I know this is an easy one, but I just thought I could spare myself some (more) time searching through the documentation.
Usually, when I have an "Add" and a "Remove" button, along with an NSArrayController, I simply have to click-drag from each button and connect them to the add: and remove: actions of the NSArrayController.
Now, I'm trying to do the very same thing, programmatically with NSArrayController (co) :
[addButton setAction:#selector(add:)];
[addButton setTarget:co];
What am I doing wrong?
The rest of the NSArrayController operations, handling an NSMutableArray of dictionaries, etc works fine.
My psychic debugger* tells me that you're probably doing this in an init method, where neither of the outlets, to the array controller or the button, are connected yet.
Put this into awakeFromNib or a method which you know is called after the xib is loaded.
*psydb, of course.

UIButton in objective c [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
what is the function of UIButton in " UIButton *storenumber;
UIButton * is the type of the pointer. storenumber is a variable that points to an instance of the UIButton class.
As Caleb said, it is a pointer type. This is very useful whenever you have a button in your app, especially because you will need it to release the button in the dealloc method. I have also found that it is useful because you it will let you change the image, size, position, ect. of the button. If you don't know how to use these things, look at the examples below.
- (void) dealloc {
[someButton release];
}
This will release the button, thereby allowing giving you more memory to work with. The following examples are used quite often by programmers.
[someButton setHidden:(BOOL)];
[someBuuton setImage:(UIImage*) forState:(UIControlState)];
[someButton setFrame:(CGRect)];
I hope this helps!