Search Results

Search found 2441 results on 98 pages for 'delegate'.

Page 17/98 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • UIViewTableCell didSelectRowAtIndexPath is calling but not pushing a view controller

    - by Kenneth
    Hi guys, so im having a UIViewController view with a UITableView. So the UIViewController class name is SelectionScreen. The UITableView class name is SelectionScreenTable. Picture: http://img717.imageshack.us/i/screenshot20100609atpm0.png/ I have declared a UITableView *selectionTable in SelectionScreen class and connected it to the xib file of the SelectionScreen what the problem is , is that when i click a row in the table,it stays selected as highlighted blue, it calls the didSelectRowAtIndexPath (checked with NSLog) but not pushing a new view which is called(GraphView). This is the code which i use to call the new controller WHICH WORKS with a normal button GraphView *aSelectionScreenViewController = [[GraphView alloc] initWithNibName:@"GraphView" bundle:nil]; [self presentModalViewController:aSelectionScreenViewController animated: YES]; [aSelectionScreenViewController release]; I searched around and found that I need to set a delegate for the table in the UITableView class itself on the viewload tableview.delegate = self; or self.tableview.delegate = self; But it was not working. the controller was still not being pushed, and yes i have checked the controller is not nil as i tried it with a simple button. So i was thinking whether i should set the delegate of the UITableView at the UIViewController instead, so i tried this code selectionTable.delegate = selectionTable.self; but obviously it did not work =\, it messed up the whole UITableView and caused all the cells to be its predefined settings. So does anybody have any idea on how i can get it to work.

    Read the article

  • NSNotification on multiple objects

    - by Jan Hendrix
    Hi, In my NSApp delegate I add an observer of an object that is an NSWindow subclass that gets initiated in the delegate itself and that posts a notification once the window gets clicked. The selector is also in the delegate. From that same delegate class I initiate another object which when initiated adds itself as an observer for another window of the same NSWindow subclass of above and the selector is in this newly initiated class too. Both notifications get posted but the problem is that they get posted in both classes... Is this normal? I was hoping that it only got posted once.

    Read the article

  • Using NSDictionary throughout an iphone project

    - by Guy
    Hi guys, How do you access a NSDictionary in different NSViewControllers. The NSDictionary was initialized in my delegate file. Do I have to import my delegate file to each view controller file or do all my views on top of my delegate know of my NSDictionary? Do I possibly need to declare my Dictionary in each file? -Thanks Guy

    Read the article

  • NSURLConnection and empty post variables

    - by SooDesuNe
    I'm at my wits end with this one, because I've used very similar code in the past, and it worked just fine. The following code results in empty $_POST variables on the server. I verified this with: file_put_contents('log_file_name', "log: ".$word, FILE_APPEND); the only contents of log_file_name was "log: " I then verified the PHP with a simple HTML form. It performed as expected. The Objective-C: NSString *word = "this_word_gets_lost"; NSString *myRequestString = [NSString stringWithFormat:@"word=%@", word]; [self postAsynchronousPHPRequest:myRequestString toPage:@"http://www.mysite.com/mypage.php" delegate:nil]; } -(void) postAsynchronousPHPRequest:(NSString*)request toPage:(NSString*)URL delegate:(id)delegate{ NSData *requestData = [ NSData dataWithBytes: [ request UTF8String ] length: [ request length ] ]; NSMutableURLRequest *URLrequest = [ [ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: URL ] ]; [ URLrequest setHTTPMethod: @"POST" ]; [ URLrequest setHTTPBody: requestData ]; [ NSURLConnection connectionWithRequest:URLrequest delegate:delegate]; [URLrequest release]; } The PHP: $word = $_POST['word']; file_put_contents('log_file_name', "log: ".$word, FILE_APPEND); What am I doing wrong in the Objective-C that would cause the $_POST variable to be empty on the server?

    Read the article

  • How to solve Memory leaks in Lib Xml Parser in objective-C where the list is returned?

    - by Madan Mohan
    Hi Guys, I got leaks in Lib Xml Parser while retrieving the data from the net, Here in the below code, I have allocated the list - (void)getCustomersList { // make an operation so we can push it into the queue SEL method = @selector(parseForData); NSInvocationOperation *op = [[NSInvocationOperation alloc] initWithTarget:self selector:method object:nil]; customersTempList = [[NSMutableArray alloc] initWithCapacity:20];// allocated list [self.retrieverQueue addOperation:op]; [op release]; } // return each recode // in parser .m class one of the condition in endElement where it shows a leak. else if(0 == strncmp((const char *)localname, kCustomerElement, kCustomerElementLength)) { [customersTempList addObject:customer]; printf("\n no of objects in temp list:%d", [customersTempList count]); if ([customersTempList count] == 20) { NSMutableArray* argsList = [customersTempList copy];//////////////////////here it is showing leak. printf("\n Calling reload data with %d new objects", [argsList count]); SEL selector = @selector(parser:addCustomerObject:); NSMethodSignature *sig = [(id)self.delegate methodSignatureForSelector:selector]; if(nil != sig && [self.delegate respondsToSelector:selector]) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig]; [invocation retainArguments]; [invocation setTarget:self.delegate]; [invocation setSelector:selector]; [invocation setArgument:&self atIndex:2]; [invocation setArgument:&argsList atIndex:3]; [invocation performSelectorOnMainThread:@selector(invoke) withObject:NULL waitUntilDone:NO]; } [customersTempList removeAllObjects]; } } // returned the list after all the records are stored in the list else if(0 == strncmp((const char *)localname, kCustomersElement, kCustomersElementLength)) { printf("\n Calling reload data with %d new objects", [customersTempList count]); NSMutableArray* argsList = [customersTempList copy]; printf("\n Calling reload data with %d new objects", [argsList count]); SEL selector = @selector(parser:addCustomerObject:); NSMethodSignature *sig = [(id)self.delegate methodSignatureForSelector:selector]; if(nil != sig && [self.delegate respondsToSelector:selector]) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig]; [invocation retainArguments]; [invocation setTarget:self.delegate]; [invocation setSelector:selector]; [invocation setArgument:&self atIndex:2]; [invocation setArgument:&argsList atIndex:3]; [invocation performSelectorOnMainThread:@selector(invoke) withObject:NULL waitUntilDone:NO]; } [customersTempList removeAllObjects]; } } please help me out of this, Thanks, Madan.

    Read the article

  • jQuery: delegating clicks to elements that contain other elements

    - by Master Morality
    So i get the gist of $.delegate and I know why it's doing what it's doing, but I'm wondering if there is a work around. I have link elements that contain spans like so: <a href='#'> <span>Person Name</span> <span>Person Info</span> </a> I use the following code in jQuery for event delegation: containerElement.delegate('click','a',function(){...}); The trouble is that this only triggers when I click on white space not occupied by a span. I know it does this because delegate simply compares the event target to 'a' to check if it should fire the delegate, however I want to include the spans as well, pretty much anything inside the <a>...</a> what do?

    Read the article

  • Can`t draw in CAlayer.

    - by Ann
    HI All. I have subclass of UIScrollView. IN this class I have added some imageView.layer to self.layer. And when I call [imageView.layer setNeedsDisplay] my implemented delegate never called. -(void)drawLayer:(CALayer*)layer :(CGContextRef)context I`ve also set imageView.layer.delegate = self Could anyone tell me where I must set delegate function to make this to work. Thank you for advance.

    Read the article

  • Problem in setting backgound color to my TreeCellRenderer

    - by Sunil Kumar Sahoo
    Hi I have cretaed my own renderer. I want the back ground should be blue. I have set background color as blue also. But I donot know what is tha problem that the background color of my renderer always seems to be white. I have post the code. please help where I am wrong so that the background color becomes white. class CheckTreeCellRenderer extends JPanel implements TreeCellRenderer { private CheckTreeSelectionModel selectionModel; private MyRenderer delegate; private TristateCheckBox checkBox = new TristateCheckBox("", null, true); public static final State NOT_SELECTED = new State(); public static final State SELECTED = new State(); public static final State DONT_CARE = new State(); public CheckTreeCellRenderer(MyRenderer delegate, CheckTreeSelectionModel selectionModel) { this.delegate = delegate; this.selectionModel = selectionModel; setLayout(new BorderLayout()); setOpaque(true); setBackground(new Color(207, 219, 234)); checkBox.setState(Boolean.TRUE); checkBox.setOpaque(true); checkBox.setBackground(new Color(207, 219, 234)); } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component renderer = delegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); TreePath path = tree.getPathForRow(row); if (path != null) { if (selectionModel.isPathSelected(path, true)) { checkBox.setState(Boolean.TRUE); } else { checkBox.setState(selectionModel.isPartiallySelected(path) ? null : Boolean.FALSE); } } renderer.setBackground(new Color(207, 219, 234)); tree.setOpaque(true); tree.setBackground(new Color(207, 219, 234)); this.setOpaque(true); this.setBackground(new Color(207, 219, 234)); add(checkBox, BorderLayout.WEST); add(renderer, BorderLayout.CENTER); return this; } }

    Read the article

  • .NET: How to pass value when subscribing to event and obtain it when the event is triggered (Dynamic

    - by Entrase
    The task is to create event handlers in runtime. I need the one method to be called with different parameter value for different events. The events and their number are only known in runtime. So I'm trying to generate dynamic methods, each of which will be assigned to some event, but in general they all just pass some value to an instance method and call it. It would be great if something similar could be done the easier way. I mean passing some value at subscribing stage and then obtaining it when the event is triggered. This is what I'm trying to do now: public class EventSource { public event EventHandler eventOne; public event EventHandler eventTwO; public event EventHandler eventThree; } public class EventListener { SubscribeForEvents() { BindingFlags flags = BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance; // Suppose we've already got EventInfo // and target source somewhere // so we can do eventInfo.AddEventHandler(target, delegate) // Now we need a delegate. int value = 42; Type tDelegate = eventInfo.EventHandlerType; // http://msdn.microsoft.com/en-us/library/ms228976(VS.95).aspx Type returnType = GetDelegateReturnType(tDelegate); DynamicMethod listener = new DynamicMethod("", null, GetDelegateParameterTypes(tDelegate), this.GetType()); ///////// Type[] callParameters = { typeof(int) }; MethodInfo method = this.GetType().GetMethod("ToCallFromDelegate", flags); ILGenerator generator = listener.GetILGenerator(); // No success in this mess. What's wrong? generator.Emit(OpCodes.Ldc_I4, value); generator.Emit(OpCodes.Call, method); generator.Emit(OpCodes.Pop); generator.Emit(OpCodes.Ret); ///////////// Delegate delegate = listener.CreateDelegate(tDelegate); eventInfo.AddEventHandler(target, delegate); // When triggered, there is InvalidProgramException } void ToCallFromDelegate(int value) { doSomething(); } }

    Read the article

  • C# parameter count mismatch when trying to add AsyncCallback into BeginInvoke()

    - by PunX
    I have main form (PrenosForm) and I am trying to run Form2 asynchronously. It works without callback delegate: this.BeginInvoke(cp, new object[] { datoteke, this.treeView1.SelectedNode.FullPath.ToString(), this, efekt }, null); //works 1. Doesn't work with callback delegate (parameter count mismatch): this.BeginInvoke(cp, new object[] { datoteke, this.treeView1.SelectedNode.FullPath.ToString(), this, efekt }, new AsyncCallback(callBackDelegate), null); //doesn't work parameter count mismatch 2. Works with callback delegate if I do it like this: cp.BeginInvoke(datoteke, this.treeView1.SelectedNode.FullPath.ToString(), this, efekt, new AsyncCallback(callBackDelegate), null); //works 3. My question is why does one way work and the other doesn't? I'm new at this. Would anyone be so kind as to answer my question and point out my mistakes? private delegate void copyDelegat(List<ListViewItem> datoteke, string path, PrenosForm forma, DragDropEffects efekt); private delegate void callBackDelegat(IAsyncResult a); public void doCopy(List<ListViewItem> datoteke, string path, PrenosForm forma, DragDropEffects efekt) { new Form2(datoteke, path, forma, efekt); } public void callBackFunc(IAsyncResult a) { AsyncResult res = a.AsyncState as AsyncResult; copyDelegat delegat = res.AsyncDelegate as copyDelegat; delegat.EndInvoke(a); } public void kopiraj(List<ListViewItem> datoteke, DragDropEffects efekt) { copyDelegat cp = new copyDelegat(doCopy); callBackDelegat callBackDelegate = new callBackDelegat(callBackFunc); this.BeginInvoke(cp, new object[] { datoteke, this.treeView1.SelectedNode.FullPath.ToString(), this, efekt }, new AsyncCallback(callBackDelegate), null); //doesn't work parameter count missmatch 2. this.BeginInvoke(cp, new object[] { datoteke, this.treeView1.SelectedNode.FullPath.ToString(), this, efekt }, null); //works 1. cp.BeginInvoke(datoteke, this.treeView1.SelectedNode.FullPath.ToString(), this, efekt, new AsyncCallback(callBackDelegate), null); //works 3. }

    Read the article

  • Anonymous types based in Interface

    - by Bhaskar
    Can I create anonymous implementations of an interface , in a way similar to the way delegate() { // type impl here , but not implementing any interface} Something on the lines of new IInterface() { // interface methods impl here } The situations where I see them to be useful are for specifying method parameters which are interface types, and where creating a class type is too much code. For example , consider like this : public void RunTest() { Cleanup(delegate() { return "hello from anonymous type"; }); } private void Cleanup(GetString obj) { Console.WriteLine("str from delegate " + obj()); } delegate string GetString(); how would this be achieved if in the above code , the method Cleanup had an interface as a parameter , without writing a class definition ? ( I think Java allows expressions like new Interface() ... )

    Read the article

  • How do I override a Spring bean definition yet still reference the overriden bean?

    - by Kevin
    I'm attempting to implement a delegate Service provider by overriding the bean definition for the original service with my delegate Service. However, as the name would imply, the delegate Service needs a reference to the original service to delegate calls to. I'm having trouble figuring out how to override the bean definition while using the original bean def without running into a circular reference issue. For example: <!-- Original service def in spring-context.xml --> <bean id="service" class="com.mycompany.Service"/> <!-- Overridden definition in spring-plugin-context.xml --> <bean id="service" class="com.mycompany.DelegatedService"/> <constructor-arg ref="service"/> </bean> Is this possible?

    Read the article

  • UIViewController is popped from view stack and NSURLConnection crashes the application

    - by rickharrison
    I am pushing a UIViewController onto a UINavigationController. This view controller immediately starts a download of an xml feed and then parses it. However, if you hit the back button before it is done downloading, and crashes with EXC_BAD_ACCESS. The line that is crashing it is in parserDidEndDocument and is this line: if (self.delegate && [self.delegate conformsToProtocol:@protocol(ModelDelegate)]) [self.delegate modelDidFinishParsing:self]; I assume it is crashing because it is trying to access self.delegate which is not assigned anymore. How do I get around this? Also, I would release the model object in the modelDidFinishParsing method. How would I release this model if it never reaches this method.

    Read the article

  • Delegates doesnot work properly

    - by Warrior
    I am new to iphone development.I am covering the date to the desired format and set it to the delegates and get its value in the another view.The session restarts when i tried to get the value from delegates.If i set the original date and not the formatted date in the set delegate ,then i able to get the value in the another view.If i also give any static string value,then also i am able to the static string value back.Only the formatted date which is string is set then the session restarts.If i print and check the value of the formatted date it prints the correct formatted date only.Please help me out.Here is my code for date conversion NSString *dateval=[[stories objectAtIndex: storyIndex] objectForKey:@"date"]; NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; [inputFormatter setDateFormat:@"EEE, MMM dd, yyyy"]; NSDate *inputDate = [inputFormatter dateFromString:dateval]; NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; [outputFormatter setDateFormat:@"MMMM dd"]; NSString *outputDate = [outputFormatter stringFromDate:inputDate]; AppDelegate *delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate]; [delegate setCurrentDates:outputDate]; Thanks.

    Read the article

  • Cocoa NSTextField Drag & Drop Requires Subclass... Really?

    - by ipmcc
    Until today, I've never had occasion to use anything other than an NSWindow itself as an NSDraggingDestination. When using a window as a one-size-fits-all drag destination, the NSWindow will pass those messages on to its delegate, allowing you to handle drops without subclassing NSWindow. The docs say: Although NSDraggingDestination is declared as an informal protocol, the NSWindow and NSView subclasses you create to adopt the protocol need only implement those methods that are pertinent. (The NSWindow and NSView classes provide private implementations for all of the methods.) Either a window object or its delegate may implement these methods; however, the delegate’s implementation takes precedence if there are implementations in both places. Today, I had a window with two NSTextFields on it, and I wanted them to have different drop behaviors, and I did not want to allow drops anywhere else in the window. The way I interpret the docs, it seems that I either have to subclass NSTextField, or make some giant spaghetti-conditional drop handlers on the window's delegate that hit-checks the draggingLocation against each view in order to select the different drop-area behaviors for each field. The centralized NSWindow-delegate-based drop handler approach seems like it would be onerous in any case where you had more than a small handful of drop destination views. Likewise, the subclassing approach seems onerous regardless of the case, because now the drop handling code lives in a view class, so once you accept the drop you've got to come up with some way to marshal the dropped data back to the model. The bindings docs warn you off of trying to drive bindings by setting the UI value programmatically. So now you're stuck working your way back around that too. So my question is: "Really!? Are those the only readily available options? Or am I missing something straightforward here?" Thanks.

    Read the article

  • iPhone: Run method from another view

    - by Nic Hubbard
    I have two views that I am loading, the first is a view with an MKMapView, the second has a table view. I would like to access a method in the first views controller, from the second view. I have been told to use the delegate for this, but I can't get it right. In my app delegate, I have set up added properties for the class of my first view. Then, in my second view, I try to access the first view using the delegate: MyAppDelegate *mainDelegate = (MyAppDelegate*) [[UIApplication sharedApplication] delegate]; Then try: [mainDelegate.mapViewControllerClass myMethodToRun]; It seems to me that it should be calling the myMethodToRun method, which is in my map view. But, it does not work. What is wrong with what I am doing here? There must be a way to access a method of another view...

    Read the article

  • Attach GestureRecogniser to multiple imageviews

    - by AppleDeveloper
    Something strange I encountered today while attaching same gesture recogniser to multiple image views. It gets attached to only the last one, in other words, it can be attached to only one view! I had to create multiple gesture recognisers to meet my requirements. Following is what I have done. Am I doing correct? Is that's the only way to attach recognisers to the multiple imageviews? Please note that I don't want to use UITableView or UIVIew and put all imageviews in it and attach gesture recogniser to only UITableView or UIVIew. I have all image scattered and I have to detect which image is being dragged. Thanks. [imgView1 setUserInteractionEnabled:YES]; [imgView1 setMultipleTouchEnabled:YES]; [imgView2 setUserInteractionEnabled:YES]; [imgView2 setMultipleTouchEnabled:YES]; [imgView3 setUserInteractionEnabled:YES]; [imgView3 setMultipleTouchEnabled:YES]; [imgView4 setUserInteractionEnabled:YES]; [imgView4 setMultipleTouchEnabled:YES]; [imgView5 setUserInteractionEnabled:YES]; [imgView5 setMultipleTouchEnabled:YES]; [imgView6 setUserInteractionEnabled:YES]; [imgView6 setMultipleTouchEnabled:YES]; //Attach gesture recognizer to each imagviews gestureRecognizer1 = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)]; gestureRecognizer1.delegate = self; gestureRecognizer2 = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)]; gestureRecognizer2.delegate = self; gestureRecognizer3 = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)]; gestureRecognizer3.delegate = self; gestureRecognizer4 = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)]; gestureRecognizer4.delegate = self; gestureRecognizer5 = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)]; gestureRecognizer5.delegate = self; gestureRecognizer6 = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)]; gestureRecognizer6.delegate = self; [imgView1 addGestureRecognizer:gestureRecognizer1]; [imgView2 addGestureRecognizer:gestureRecognizer2]; [imgView3 addGestureRecognizer:gestureRecognizer3]; [imgView4 addGestureRecognizer:gestureRecognizer4]; [imgView5 addGestureRecognizer:gestureRecognizer5]; [imgView6 addGestureRecognizer:gestureRecognizer6];

    Read the article

  • How to find out if a method exists in Obj-C when given an NSString

    - by Justin
    I have a method as an NSString *. If it exists, I want to call it, and if not, do nothing. SEL eventSelector = NSSelectorFromString(eventSelectorStr); if ([delegate respondsToSelector:eventSelector]) { [delegate performSelector:eventSelector]; [delegate adapterDidFinishAdRequest:self]; } else { // Does not implement selector } This code does not work, since NSSelectorFromString will register the string as a selector, so respondsToSelector:eventSelector will cause a crash because the selector is actually invalid.

    Read the article

  • Error exposing event througt interface

    - by carlos
    I have this interface Interface IProDataSource Delegate Sub DstartingHandler(ByVal sender As Object, ByVal e As EventArgs) Event starting_Sinc As DstartingHandler End Interface Trying to use the intarce like this Public Class DataSource : Implements IProDataSource Public Event starting_Sinc As DstartingHandler Implements IProDataSource.starting_Sinc Public Delegate Sub DstartingHandler(ByVal sender As Object, ByVal e As EventArgs) End Class Gives me the next error Event 'starting_Sinc' cannot implement event 'starting_Sinc' on interface 'IProDataSource' because their delegate types 'DstartingHandler' and 'IProDataSource.DstartingHandler' do not match.

    Read the article

  • How i can i use the value of a variable from one class in another in objective c?

    - by user337174
    Hi i am fairly new to objective c and have been doing some iphone programming. Is it possible to look up the value of a variable in a different class? Basically what i am doing is running a function that exists in my app delegate from a view controller, but the app delegate needs to use a variable stored in the view controller from which the app delegate function was called. Make sense??? Any help would be grateful. James

    Read the article

  • Reload a UITable on the fly when editing a UITextField inside one of the cells

    - by Saze
    I have a UITable containing some customs UITableCells. Those cells contain a few UILabels and a UITextField. The datasource of the table comes from a main controller's property. (This controller is also the delegate and the dataSource for the table). Here's a simplified screenshot of the UI: Now, I need to update "on the fly" the content of all the UILabels when the user edits one of the UITextFields. To do so, at the I am listening to the "Editing Changed" event at the UITextField level. This triggers the following action: - (IBAction) editChangeHandler: (id) sender { MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [[delegate.viewController.myDataSourceArray objectAtIndex:self.rowIndex] setANumber: [theTextField.text intValue]]; [delegate.viewController reloadRows]; } The reloadRows method in the viewController is as such: - (void) reloadRows { NSLog(@"called reloadRows"); //perform some calculations on the data source objects here... [theUITable reloadData]; } My problem here is that whenever the user changes the value in the field, the reloadRows method is successfully called, so is apparently the reloadData but it also causes the keyboard to be dismissed. So in the end, the user can only touch one key when editing the TextField before the keyboard is dismissed and the table reloaded. Does anybody knows a solution to this or have experienced the same issue?

    Read the article

  • why i change the alpha value of UIImageView but no effect?

    - by chancy
    I am working on a reader app. when you read one magazine, it will display first five pages and download the rest pages one by one. there is a scrollview to view the thumbnail image of pages. At the beginning, if the page needs downloading, the corresponding thumbnail view's alpha value is set to 0.5. when the page is downloaded, i will update the thumbnail view's value to 1.0. I use one operation to download the page, and when one is downloaded i use delegate to set thumbnail view's alpha. But when i update thumbnail view's alpha value, it still the same as the beginning. it seems the alpha has no effect. I wonder is there anything wrong with my code? some snippets are as follows: In the PageViewController.m - (void)downloadPages { DownloadOperation *op = [[DownloadOperation alloc] initWithMagazine:magazine]; op.delegate = self; [[(AppDelegate *)[[UIApplication sharedApplication] delegate] sharedOperationQueue] addOperation:op]; } - (void)downloadOperation:(DownloadOperation *)operation finishedAtIndex:(NSUInteger)index { if (thumbScrollView){ [thumbScrollView viewWithTag:THUMBVIEW_OFFSET+index].alpha = 1.0; } } In DownloadOperation.m - (void)main { // ... NSUInteger index = 0; for (Page *page in mMagazine.pages) { if (/*page doesn't exist*/){ // download the page; if ([delegate respondsToSelector:@selector(downloadOperation:finishedAtIndex:)]) { [delegate downloadOperation:self finishedAtIndex:index]; } } index++; } }

    Read the article

  • Passing a bool condition to method which I can invoke when I need

    - by dotnetdev
    Hi, I need to pass in a predicate which I can invoke whenever I want (just like a delegate). I am trying to do something like this (I thought Predicate delegate would meet my needs): MyMethod(Predicate,string pred); Called like: MyMethod(s = s.Length 5); I want to write the condition inline BUT invoke it when I want, just like a delegate. How could I do this? Thanks

    Read the article

  • Automatic conversion between methods and functions in Scala

    - by fikovnik
    I would like to understand the rules when can Scala automatically convert methods into functions. For example, if I have following two methods: def d1(a: Int, b: Int) {} def r[A, B](delegate: (A, B) ? Unit) {} I can do this: r(d1) But, when overloading r it will no longer work: def r[A, B, C](delegate: (A, B, C) ? Unit) {} r(d1) // no longer compiles and I have to explicitly convert method into partially applied function: r(d1 _) Is there any way to accomplish following with the explicit conversion? def r[A, B](delegate: (A, B) ? Unit) {} def r[A, B, C](delegate: (A, B, C) ? Unit) {} def d1(a: Int, b: Int) {} def d2(a: Int, b: Int, c: Int) {} r(d1) // only compiles with r(d1 _) r(d2) // only compiles with r(d2 _) There is somewhat similar question, but it is not fully explained.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >